Skip to content

Commit

Permalink
refactor: scheduled handler type, return response
Browse files Browse the repository at this point in the history
  • Loading branch information
bharati-21 committed Oct 1, 2023
1 parent fec88f7 commit 47859de
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ export default {
// We need to keep all 3 parameters in this format even if they are not used as as cloudflare workers need them to be present So we are disabling eslint rule of no-unused-vars
// for more details read here: https://community.cloudflare.com/t/waituntil-is-not-a-function-when-using-workers-with-modules/375781/4
// eslint-disable-next-line no-unused-vars
async scheduled(req: Request, env: env, ctx: ExecutionContext) {
async scheduled(req: ScheduledController, env: env, ctx: ExecutionContext) {
switch (req.cron) {
case '0 */4 * * *':
ctx.waitUntil(ping(env));
break;
case '0 */6 * * *':
await callDiscordNicknameBatchUpdate(env);
break;
return await callDiscordNicknameBatchUpdate(env);
default:
console.log('Unknown Trigger Value!');
}
Expand Down

0 comments on commit 47859de

Please sign in to comment.