clockwork
clockwork copied to clipboard
Question: Multiple At
I am new into this library and I would know if there is the possibility to implement multiple scheduled hours using At
method.
Example
sched.Schedule().Every(2).Days().At("9:30").At("11:30").Do(something)
Or
sched.Schedule().Every(2).Days().At([]string{"12:32", "11:30"}).Do(something)
Looks cool, shouldn't be too hard to implement, you can try it and open a PR if you want :)
Is this issue still open?
@unishubh it is tagged as open, are you working on a pr or waiting for whiteshtef to add it in?
@pizzalord22 it is still open. Is use of multiple At
statements really that useful?
I could implement it if you find it easier to use.
I personally use
sched.Schedule().Every().Day().At("xxx").Do(foo)
sched.Schedule().Every().Day().At("yyy").Do(foo)
because it seems more readable than
sched.Schedule().Every().Day().At("xxx").At("yyy").Do(foo)
If you really want it as a one-liner, it shouldn't be too hard to implement,
but it will ad some complexity to the scheduleNextRun()
method which is already horrible as it is.
@whiteShtef i would go for readability, since keeping things readable and as simple as possible makes it easier to implement new things.
that being said it might be nice to have multiple function ran in the same row in a certrain order.