Skip to content

Commit

Permalink
Removes 4hr cron trigger (#36)
Browse files Browse the repository at this point in the history
* fix/service binding changes

* refactor: updates wrangler environment for service binding

* fix: removes 4hr cron

---------

Co-authored-by: Prakash Choudhary <34452139+prakashchoudhary07@users.noreply.github.com>
  • Loading branch information
Ajeyakrishna-k and prakashchoudhary07 authored Dec 15, 2023
1 parent 90d8c43 commit b0011d3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
10 changes: 4 additions & 6 deletions src/worker.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
import { addMissedUpdatesRole, callDiscordNicknameBatchUpdate, ping } from './handlers/scheduledEventHandler';
import { addMissedUpdatesRole, callDiscordNicknameBatchUpdate } from './handlers/scheduledEventHandler';
import { env } from './types/global.types';

const EVERY_4_HOURS = '0 */4 * * *';
const EVERY_6_HOURS = '0 */6 * * *';
const EVERY_12_HOURS = '0 */12 * * *';

export default {
// eslint-disable-next-line no-unused-vars
async scheduled(req: ScheduledController, env: env, ctx: ExecutionContext) {
switch (req.cron) {
case EVERY_4_HOURS:
ctx.waitUntil(ping(env));
break;
case EVERY_6_HOURS:
case EVERY_6_HOURS: {
return await callDiscordNicknameBatchUpdate(env);
}
case EVERY_12_HOURS: {
return await addMissedUpdatesRole(env);
}
Expand Down
2 changes: 1 addition & 1 deletion wrangler.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ services = [
]

[triggers]
crons = ["0 */4 * * *", "0 */6 * * *","0 */12 * * *" ]
crons = ["0 */6 * * *","0 */12 * * *" ]

# # Durable Object binding - For more information: https://developers.cloudflare.com/workers/runtime-apis/durable-objects
# [[durable_objects]]
Expand Down

0 comments on commit b0011d3

Please sign in to comment.