mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-14 00:19:16 +01:00
fix: differentiated interval and initial schedule call (#5896)
Differentiate log lines so we can see if it happens on every call, or just on the initial call.
This commit is contained in:
parent
22acadf4cc
commit
9d839299e2
@ -17,7 +17,7 @@ export default class MaintenanceService implements IMaintenanceStatus {
|
|||||||
|
|
||||||
constructor(config: IUnleashConfig, settingService: SettingService) {
|
constructor(config: IUnleashConfig, settingService: SettingService) {
|
||||||
this.config = config;
|
this.config = config;
|
||||||
this.logger = config.getLogger('services/pat-service.ts');
|
this.logger = config.getLogger('services/maintenance-service.ts');
|
||||||
this.settingService = settingService;
|
this.settingService = settingService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,8 +177,8 @@ test('Can handle crash of a async job', async () => {
|
|||||||
|
|
||||||
schedulerService.stop();
|
schedulerService.stop();
|
||||||
expect(getRecords()).toEqual([
|
expect(getRecords()).toEqual([
|
||||||
['scheduled job failed | id: test-id-10 | async reason'],
|
['initial scheduled job failed | id: test-id-10 | async reason'],
|
||||||
['scheduled job failed | id: test-id-10 | async reason'],
|
['interval scheduled job failed | id: test-id-10 | async reason'],
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -197,8 +197,8 @@ test('Can handle crash of a sync job', async () => {
|
|||||||
|
|
||||||
schedulerService.stop();
|
schedulerService.stop();
|
||||||
expect(getRecords()).toEqual([
|
expect(getRecords()).toEqual([
|
||||||
['scheduled job failed | id: test-id-11 | Error: sync reason'],
|
['initial scheduled job failed | id: test-id-11 | Error: sync reason'],
|
||||||
['scheduled job failed | id: test-id-11 | Error: sync reason'],
|
['interval scheduled job failed | id: test-id-11 | Error: sync reason'],
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -217,8 +217,8 @@ test('Can handle crash of a async job', async () => {
|
|||||||
|
|
||||||
schedulerService.stop();
|
schedulerService.stop();
|
||||||
expect(getRecords()).toEqual([
|
expect(getRecords()).toEqual([
|
||||||
['scheduled job failed | id: test-id-10 | async reason'],
|
['initial scheduled job failed | id: test-id-10 | async reason'],
|
||||||
['scheduled job failed | id: test-id-10 | async reason'],
|
['interval scheduled job failed | id: test-id-10 | async reason'],
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ export class SchedulerService {
|
|||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.logger.error(
|
this.logger.error(
|
||||||
`scheduled job failed | id: ${id} | ${e}`,
|
`interval scheduled job failed | id: ${id} | ${e}`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}, timeMs).unref(),
|
}, timeMs).unref(),
|
||||||
@ -64,7 +64,9 @@ export class SchedulerService {
|
|||||||
await runScheduledFunctionWithEvent();
|
await runScheduledFunctionWithEvent();
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.logger.error(`scheduled job failed | id: ${id} | ${e}`);
|
this.logger.error(
|
||||||
|
`initial scheduled job failed | id: ${id} | ${e}`,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,8 +101,8 @@ test('Can handle crash of a async job', async () => {
|
|||||||
|
|
||||||
schedulerService.stop();
|
schedulerService.stop();
|
||||||
expect(getRecords()).toEqual([
|
expect(getRecords()).toEqual([
|
||||||
['scheduled job failed | id: test-id-10 | async reason'],
|
['initial scheduled job failed | id: test-id-10 | async reason'],
|
||||||
['scheduled job failed | id: test-id-10 | async reason'],
|
['interval scheduled job failed | id: test-id-10 | async reason'],
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -116,7 +116,7 @@ test('Can handle crash of a sync job', async () => {
|
|||||||
|
|
||||||
schedulerService.stop();
|
schedulerService.stop();
|
||||||
expect(getRecords()).toEqual([
|
expect(getRecords()).toEqual([
|
||||||
['scheduled job failed | id: test-id-11 | Error: sync reason'],
|
['initial scheduled job failed | id: test-id-11 | Error: sync reason'],
|
||||||
['scheduled job failed | id: test-id-11 | Error: sync reason'],
|
['interval scheduled job failed | id: test-id-11 | Error: sync reason'],
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user