reset counter, for loop, sleep 1s
Signed-off-by: blakeromano-il <blake.romano@imaginelearning.com>
This commit is contained in:
@@ -40,10 +40,9 @@ export class LocalTaskWorker {
|
||||
this.logger.info(
|
||||
`Task worker starting: ${this.taskId}, ${JSON.stringify(settings)}`,
|
||||
);
|
||||
const success = false;
|
||||
let attemptNum = 1;
|
||||
(async () => {
|
||||
while (!success) {
|
||||
for (;;) {
|
||||
try {
|
||||
if (settings.initialDelayDuration) {
|
||||
await this.sleep(
|
||||
@@ -63,12 +62,14 @@ export class LocalTaskWorker {
|
||||
);
|
||||
}
|
||||
this.logger.info(`Task worker finished: ${this.taskId}`);
|
||||
attemptNum = 0;
|
||||
break;
|
||||
} catch (e) {
|
||||
attemptNum += 1;
|
||||
this.logger.warn(
|
||||
`Task worker failed unexpectedly, attempt number ${attemptNum}, ${e}`,
|
||||
);
|
||||
await sleep(Duration.fromISO('P1S'));
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
||||
@@ -51,10 +51,9 @@ export class TaskWorker {
|
||||
this.logger.info(
|
||||
`Task worker starting: ${this.taskId}, ${JSON.stringify(settings)}`,
|
||||
);
|
||||
const success = false;
|
||||
let attemptNum = 1;
|
||||
(async () => {
|
||||
while (!success) {
|
||||
for (;;) {
|
||||
try {
|
||||
if (settings.initialDelayDuration) {
|
||||
await sleep(
|
||||
@@ -73,12 +72,14 @@ export class TaskWorker {
|
||||
}
|
||||
|
||||
this.logger.info(`Task worker finished: ${this.taskId}`);
|
||||
attemptNum = 0;
|
||||
break;
|
||||
} catch (e) {
|
||||
attemptNum += 1;
|
||||
this.logger.warn(
|
||||
`Task worker failed unexpectedly, attempt number ${attemptNum}, ${e}`,
|
||||
);
|
||||
await sleep(Duration.fromISO('P1S'));
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user