Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Persistence of Completed Activity Execution Contexts #4869

Merged
merged 8 commits into from Feb 3, 2024

Conversation

sfmskywalker
Copy link
Member

This PR introduces an optimization to the workflow instance storage by eliminating the need to persist completed activity execution contexts. This change leverages the previously introduced ActivityExecutionRecord storage, which has made the persistence of these contexts redundant. The primary reason for retaining completed activity execution contexts was to facilitate direct access to activity outputs. However, this requirement is now addressed through a recommended workaround that involves capturing activity outputs using variables.

The benefits of this optimization include:

  • A significant reduction in the storage size of workflow instances, leading to improved performance in workflow instance viewing.
  • Enhanced efficiency in serializing and deserializing workflow instances during the resume process.

By adopting this change, we aim to streamline workflow execution and management, focusing on efficiency and performance improvements.

The cancellation process in ActivityExecutionContext has been updated to now use DisposeAsync() instead of Dispose(). This implements asynchronous disposal of the cancellation registration. Additionally, a new method supporting cancellation has been added.
The code has been restructured to account for cases where there is no activity execution context available. Instead of breaking the loop in such cases, the variables are derived from the memory blocks. Also, there is minor code formatting in output handling and array conversion for async enumerables.
Introduces a safeguard in the JintJavaScriptEvaluator in the Elsa.JavaScript module. This checks whether a workflow execution context can be retrieved before trying to get its input definitions. This prevents potential errors when the context isn't available.
The commit removes unnecessary namespaces in the integration tests for JavaScript Lists and Arrays within the Elsa project. This results in a cleaner codebase, maintaining only the libraries required for the specific tests.
The updated code cleans the child contexts of any completed contexts from the list of workflows currently in execution. This change reduces the clutter and potential complications in the context management process. Previously, the unnecessary child contexts were being stored even after the parent context has been completed.
Updated the QuartzWorkflowScheduler in Elsa to prevent duplicate job scheduling. Before scheduling a job, the existence of the job is now checked first. This change has been applied to all job types - timestamp, simple schedule, and cron jobs.
Removed manual removal of child contexts from the list of active activity execution contexts. Replaced it with more efficient direct filtering of not completed activity execution contexts. This change may affect scripts that access activity output directly, but a variable capturing workaround is provided.
The term 'Unschedule' has been included to the UserDictionary within the Elsa solution settings. This update shows that 'Unschedule' is recognized in the context of the solution, thereby reducing the risk of related typographical errors.
@sfmskywalker sfmskywalker added breaking Implementation requires an API-breaking change/major version increment elsa 3 This issue is specific to Elsa 3 enhancement New feature or request labels Feb 2, 2024
@sfmskywalker sfmskywalker merged commit ff9aa54 into main Feb 3, 2024
2 checks passed
@sfmskywalker sfmskywalker deleted the issue(4862) branch February 3, 2024 09:31
@sfmskywalker sfmskywalker added this to the Elsa 3.1 milestone Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Implementation requires an API-breaking change/major version increment elsa 3 This issue is specific to Elsa 3 enhancement New feature or request
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

None yet

2 participants