elsa-workflows / elsa-workflows/elsa-core
Hangfire Temporal Activities incorrect cron time for hours
- Dominant language
- C#
- Stars
- 7.9k
- Forks
- 1.5k
- Avg merge
- 15h 22m
- Merged PRs (30d)
- 114
Description
Hi,
Im trying to create time out that will trigger after `1 hour ` so i added a `Timer` activity with `durationFromSeconds(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](https://github.com/elsa-workflows/elsa-core/blob/master/src/activities/Elsa.Activities.Temporal.Hangfire/Extensions/DurationExtensions.cs) and i feel its wrong for multiple reasons:
1. AFAIK cron only accepts 5 section
- minutes
- hours
- day of month
- month
- day of week
there is no secounds as the class inserts
2. to make the cron work for each hour the minute section should be (`0` it will be at minute `0` 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
Contributor guide
Research direction
Start with src/activities/Elsa.Activities.Temporal.Hangfire/Extensions/DurationExtensions.cs and inspect how a 3600-second Timer duration becomes the dashboard cron expression. Reproduce the reported two-to-five-second completion, then verify that a one-hour duration produces a schedule that waits 3600 seconds without triggering every minute.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100