Disabling Worker in a Specific Time?
Hey, is there any way to disable a worker in a specific time?
4 Replies
What do you mean with in a specific time? After a specific amount of time has passed? At a specific moment in time?
Yes, e.g. 1st day of september.
Depending on how you want to disable it, I would see two ways of doing this:
- Add a check to the start of your worker's code, if it's after your cutoff point, immediately return an error
- Set up either another worker with a CRON trigger, or something else that automatically triggers at the cutoff point, then sends an API request to Cloudflare to disable the worker's trigger(s)
You could also do both if you want to be sure it stops at exactly the specified time, but still want to stop billing.
Yes the second one is a good way, thank you.