Open fshahin90 opened 1 year ago
Hello,
I just started to use the schedule library and see the same issue. The code which translate TimeSpan to Cron seems to be wrong (you 2nd affirmation is correct , it should be 0 and not *)
about your first remark, in .Net a lot of library are able to manipulate a Cron that use a six-part format to allow manipulation with second (NCronTab) .
You can check this lib for info : https://github.com/atifaziz/NCrontab and also this link to test your CRON expression : https://ncrontab.swimburger.net/
and it is also a little bit more difficult to write because :
00:00:01
timespan means each sec, so the Cron will be * * * * * *
00:01:00
timespan means each minute, so the Cron will be 0 */1 * * * *
, or */60 */1 * * * *
(or 0 *)01:00:00
timespan means each hour, so the Cron will be 0 0 */1 * * *
, or */60 */60 */1 * * *
etc.So regarding the rule CreateCronComponent(int number) => (number > 0 ? $"*/{number}" : "*");
is not so easy and to convert a TimeSpan to a Cron Expression, we need to change this helper to take care of precedence.
For now, you could replace your Timer activity by a Cron to start a workflow until we deploy a fix to this activity (I don't have check Quartz, but this helper is only used in the Hangfire library)
Hi, Im trying to create time out that will trigger after
1 hour
so i added aTimer
activity withdurationFromSeconds(Number(getVariable("time_out"))) // time_out = 3600
i fount that the execution finishes imediatly within secounds like 2 to 5 secounds after execution.when i tried to debug i found in the hangfire dashboard the cron expression for the job is
* * */1 * * *
thats generated from this file and i feel its wrong for multiple reasons:there is no secounds as the class inserts
0
it will be at minute0
from each hour ) not (*
it will be every minute from each hour)but if i tested with minutes like 30 minutes it works because the Hangfire cron library interprits the string from right to left excluding the excess note: i didnt test with the Quartz Library hope that every thing is clear