Every nth day of the week of the month #273
Replies: 3 comments 3 replies
-
Hi @bbailey1024 ! There is not currently a way with the DSL to schedule every 1st Tuesday of the Month. We should add that! For specifying a specific day or days of the Month that can be done with https://pkg.go.dev/github.com/go-co-op/gocron#example-Scheduler.Month Yes of course if you were okay combing logic you could schedule weekly on Tuesdays and check the date, but I understand the need to keep these separate. Unfortunately this isn't something you can do with a cron statement alone, so the Cron method won't solve it here either. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the feedback and I figured that might be the answer. It's just an odd bit of scheduling logic that doesn't fit well into the very well defined methods this library offers, but something a client will invariably ask for I'm sure. I'll probably end up writing a function to derive the days associated with the request and create single jobs for each of those days. Perhaps tag them all with a unique id to keep them grouped. If that code doesn't come out looking too hacky I can post it here. |
Beta Was this translation helpful? Give feedback.
-
I have a similar request. Do we have a solution to run Every 2nd Monday of the month? |
Beta Was this translation helpful? Give feedback.
-
Is there a simple mechanism for scheduling this? For example, run on the 1st Tuesday of every month.
Counting weeks from a start date is only an approximation of intent and doesn't meet the requirement. Same goes for specifying a day of the month. In my use case the scheduler and function need to be independent so scheduling logic can't be included in the function.
Perhaps there's a combination of scheduling tactics I'm missing that could achieve this goal. Any tips would be helpful.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions