How to manually trigger a cron job worker?
Hi, I have a worker deployed with a cron trigger set and now I want to manually trigger the deployed worker without waiting for the cron trigger time. Is it possible? how?
5 Replies
Put the code in your exported
scheduled
function into an exported fetch
function and visit the URL of your worker. Note this does not factor in any existing code you might have in fetch
. If you do, then additional logic will be required.I see, thanks. I was looking for a more direct approach as I don't have any routes attached to my worker and wanted to keep it that way, but no worries, thanks again.
Yeah, it would be nice if there was some programmatic way to execute the scheduled function e.g. via the API, but I could not see one
Another option is to change the schedule (temporarily) to run soon. Like
10 13 * * *
(to run at 13:10). Keep in mind the schedule might run in UTC.@rdutton yup exactly and that is what i was looking for
@Alex yeah, at last i did that
thanks both