Skip to content

Commit

Permalink
#130 add a try catch for triggering the task
Browse files Browse the repository at this point in the history
because if the task is currently running, retriggering it will throw an exception and stop the backend

Signed-off-by: Long Zhang <[email protected]>
  • Loading branch information
gluckzhang committed Jan 22, 2025
1 parent 2fcd01c commit 8a3d46f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions plugins/infrawallet-backend/src/service/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,12 @@ export async function createRouter(options: RouterOptions): Promise<express.Rout
await fetchAndSaveCosts(options);
},
});
// trigger this task when the plugin starts up
scheduler.triggerTask('infrawallet-fetch-and-save-costs');
// trigger this task when the plugin starts up if the task is not running
try {
scheduler.triggerTask('infrawallet-fetch-and-save-costs');
} catch (e) {
logger.error(e);
}
}

// init CategoryMappingService
Expand Down

0 comments on commit 8a3d46f

Please sign in to comment.