Signed-off-by: Bogdan Nechyporenko <bnechyporenko@bol.com>
This commit is contained in:
Bogdan Nechyporenko
2023-10-25 21:04:05 +02:00
parent d4d0154d18
commit 9e7893d50c
2 changed files with 10 additions and 6 deletions
+2 -2
View File
@@ -45,9 +45,9 @@ export interface Config {
*
* Staled tasks are marked as failed, once task's timeout has exceeded.
*
* By default, processing interval is every 5 minutes.
* By default, the frequency is every 5 minutes.
*/
processingInterval: HumanDuration;
taskTimeoutReaperFrequency: HumanDuration;
/**
* Sets the task's heartbeat timeout, when to consider a task to be staled.
@@ -271,15 +271,19 @@ export async function createRouter(
if (scheduler && databaseTaskStore.listStaleTasks) {
await scheduler.scheduleTask({
id: 'close_stale_tasks',
frequency: readDuration(config, 'scaffolder.processingInterval', {
minutes: 5,
}),
frequency: readDuration(
config,
'scaffolder.taskTimeoutReaperFrequency',
{
minutes: 5,
},
),
timeout: { minutes: 15 },
fn: async () => {
const { tasks } = await databaseTaskStore.listStaleTasks({
timeoutS: Duration.fromObject(
readDuration(config, 'scaffolder.taskTimeout', {
seconds: 86400,
hours: 24,
}),
).as('seconds'),
});