Fixing workflow reload logic#7324
Conversation
1. TriggerScheduler was returning a null for a payload, which would cause NullReferenceException, and this would break the populator which prevented other workflow definitions from being imported/published correctly. 2. The reloader was only executing a part of the actual loading logic, meaning that workflow definitions used as activities were not correcly resolved to the expected versions
Greptile SummaryThis PR fixes two critical issues with workflow reload logic:
The Confidence Score: 4/5
|
| Filename | Overview |
|---|---|
| src/modules/Elsa.Scheduling/Services/DefaultTriggerScheduler.cs | Added null check for CronTriggerPayload to prevent NullReferenceException when payload is missing |
| src/modules/Elsa.Workflows.Runtime/Services/WorkflowDefinitionsReloader.cs | Replaced partial reload logic with full IRegistriesPopulator to properly handle workflow definitions used as activities |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[ReloadWorkflowDefinitionsAsync Called] --> B[IRegistriesPopulator.PopulateAsync]
B --> C[Stage 1: Populate Activity Registry]
C --> D[Stage 2: Populate Workflow Store<br/>skipUnregistered=false]
D --> E[Stage 3: Re-populate Activity Registry<br/>with workflow definitions as activities]
E --> F[Stage 4: Re-update Workflow Store<br/>skipUnregistered=true]
F --> G[Stage 5: Publish WorkflowDefinitionsReloaded<br/>notification to other nodes]
G --> H[Reload Complete]
style B fill:#e1f5ff
style E fill:#fff4e1
style G fill:#e8f5e9
Last reviewed commit: 42fb7f9
src/modules/Elsa.Scheduling/Services/DefaultTriggerScheduler.cs
Outdated
Show resolved
Hide resolved
Additional Comments (2)
|
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
TriggerScheduler was returning a null for a payload, which would cause NullReferenceException, and this would break the populator which prevented other workflow definitions from being imported/published correctly.
The reloader was only executing a part of the actual loading logic, meaning that workflow definitions used as activities were not correcly resolved to the expected versions