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 3, 2021
1 parent 4310353 commit 0a2ee95
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 5 additions & 1 deletion dist/index.js
Expand Up @@ -297,6 +297,10 @@ class IssuesProcessor {
this._logger.info(`${logger_service_1.LoggerService.yellow('Processing the batch of issues')} ${logger_service_1.LoggerService.cyan(`#${page}`)} ${logger_service_1.LoggerService.yellow('containing')} ${logger_service_1.LoggerService.cyan(issues.length)} ${logger_service_1.LoggerService.yellow(`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: ${logger_service_1.LoggerService.cyan(issue.updated_at)}`);
Expand Down Expand Up @@ -8866,4 +8870,4 @@ module.exports = require("zlib");;
/******/ // Load entry module and return exports
/******/ return __nccwpck_require__(3109);
/******/ })()
;
;
5 changes: 5 additions & 0 deletions src/classes/issues-processor.ts
Expand Up @@ -121,6 +121,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 0a2ee95

Please sign in to comment.