Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removes 4hr cron trigger #36

Merged
merged 4 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading