elsa-workflows / elsa-core

A .NET workflows library
https://v3.elsaworkflows.io/
MIT License
5.95k stars 1.09k forks source link

[ENH] Increase stability and performance of publishing workflow definition #5373

Closed raymonddenhaan closed 2 days ago

raymonddenhaan commented 3 weeks ago

Enhancement Request

The current way of updating the activityRegistry is prone to errors, especially in a distributed environment

Enhancement Overview

Recreating the entire activityRegistry on (almost) every change of a workflowdefinition creates a lot of overhead and race conditions can occur when the activityRegistry is cleared. Resulting in instances in which the activtyRegistry is not up-to-date and resulting in more errors.

Proposed Enhancement

Instead of the entire recreation of the activityRegistry only the workflowDefinition of the event is added or deleted. To ensure the registry being up-to-date the entire list will be refreshed when an activity can not be found in the registry.

glime-ai[bot] commented 3 weeks ago

To address the enhancement request regarding the updating of the activityRegistry in Elsa Workflows, especially in a distributed environment, the proposed enhancement suggests a more incremental approach to updating the registry. Instead of recreating the entire activityRegistry on every change of a workflow definition, which can lead to overhead and race conditions, the enhancement proposes that only the specific workflow definition affected by an event should be added or deleted from the registry. Additionally, to maintain the registry's accuracy, a full refresh of the list would be triggered when an activity cannot be found in the registry.

This approach aims to reduce errors and ensure that the activityRegistry remains up-to-date without the need for constant full recreation. It would likely involve changes to the underlying code that manages the activityRegistry, ensuring that it can handle incremental updates and refreshes as needed.

Implementing this enhancement would require a careful review of the current implementation of the activityRegistry, as well as the development and testing of the new incremental update logic. It would be important to ensure that this change does not introduce new issues or negatively impact the performance of the system.

If you are experiencing specific issues with the activityRegistry in your current setup, or if you have further questions about implementing this enhancement, please provide more details so that we can assist you more effectively.

This comment was generated by Glime.