Skip to content

Commit

Permalink
fix(operations): fail fast the current batch to respect the operation…
Browse files Browse the repository at this point in the history
…s limit

Instead of processing an entire batch of 100 issues before checking the operations left, simply do it before processing an issue so that we respect as expected the limitation of the operations per run
Fixes actions#466
  • Loading branch information
C0ZEN committed Jun 2, 2021
1 parent e884599 commit 2ea4059
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions dist/index.js
Expand Up @@ -300,6 +300,10 @@ class IssuesProcessor {
this._logger.info(chalk_1.default.yellow(`Processing the batch of issues ${chalk_1.default.cyan(`#${page}`)} containing ${chalk_1.default.cyan(issues.length)} issue${issues.length > 1 ? 's' : ''}...`));
}
for (const issue of issues.values()) {
// Stop the processing if no more operations remains
if (!this._operations.hasRemainingOperations()) {
break;
}
const issueLogger = new issue_logger_1.IssueLogger(issue);
(_b = this._statistics) === null || _b === void 0 ? void 0 : _b.incrementProcessedItemsCount(issue);
issueLogger.info(`Found this $$type last updated at: ${chalk_1.default.cyan(issue.updated_at)}`);
Expand Down
5 changes: 5 additions & 0 deletions src/classes/issues-processor.ts
Expand Up @@ -117,6 +117,11 @@ export class IssuesProcessor {
}

for (const issue of issues.values()) {
// Stop the processing if no more operations remains
if (!this.operations.hasRemainingOperations()) {
break;
}

const issueLogger: IssueLogger = new IssueLogger(issue);
this._statistics?.incrementProcessedItemsCount(issue);

Expand Down

0 comments on commit 2ea4059

Please sign in to comment.