From b0011d383a52e8d0dc5379837d42770994a68088 Mon Sep 17 00:00:00 2001 From: Ajeyakrishna <98796547+Ajeyakrishna-k@users.noreply.github.com> Date: Sat, 16 Dec 2023 01:49:35 +0530 Subject: [PATCH] Removes 4hr cron trigger (#36) * 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> --- src/worker.ts | 10 ++++------ wrangler.toml | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/worker.ts b/src/worker.ts index c1daf9a..ea872dd 100644 --- a/src/worker.ts +++ b/src/worker.ts @@ -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); } diff --git a/wrangler.toml b/wrangler.toml index 2af8848..da44cc5 100644 --- a/wrangler.toml +++ b/wrangler.toml @@ -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]]