elsa-workflows / elsa-workflows/elsa-extensions

Scheduled HangFire Jobs duplicate on server restart

Open
#121 0 comments 0 reactions 0 assignees View on GitHub
triaged
Dominant language
C#
Stars
49
Forks
48
Avg merge
21h 35m
Merged PRs (30d)
20

Description

If you use an activity like `StartAt`, then Elsa will schedule the `ResumeWorkflowJob.ExecuteAsync` job in Hangfire to run at the specified start at timestamp.
Hangfire stores those persistently in the Hangfire.Jobs table, so they survive a server reboot.
Everytime the Elsa server application rebootst though, Elsa will schedule another `ResumeWorkflowJob.ExecuteAsync` for all workflow instances currently suspended on such an activity, regardless if a job is already scheduled.
This very rapidly creates thousands of duplicate scheduled jobs in the hangfire dashboard.

Seen in Elsa 3.6-rc2

Contributor guide

Open the contributing guide

Research direction

Start by tracing where Elsa schedules ResumeWorkflowJob.ExecuteAsync for workflow instances suspended on a StartAt activity, then inspect how existing scheduled jobs are represented in Hangfire.Jobs across a server restart. Done means restarting the Elsa server does not create duplicate scheduled jobs for the same suspended workflow.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.