Commit graph

5624 commits

Author SHA1 Message Date
Sipke Schoorstra 67b950f86c Refactor to use target-typed object creation
Replaced explicit type initializations with concise target-typed `new()` expressions where applicable, improving code readability and aligning with updated C# conventions. Updated .editorconfig to enforce consistent use of `var` for type declarations.
2025-01-09 10:27:55 +01:00
Sipke Schoorstra ace32dd50e
Merge pull request #6272 from elsa-workflows/perf/serialization
Refactor JsonWorkflowStateSerializer to improve performance
2025-01-07 11:27:33 +01:00
Sipke Schoorstra aef5921979 Refactor reference handling in serialization classes
Replaces static resolver state with an instance-level resolver in `CrossScopedReferenceHandler` to enhance flexibility and thread-safety. Refactors `JsonWorkflowStateSerializer` to use `GetOptions` for improved API consistency and clarity.
2025-01-06 18:11:11 +01:00
Sipke Schoorstra 25d9608b25 Refactor reference handling logic for serialization.
Replaced `PerCallReferenceHandlerWrapper` with `CrossScopedReferenceHandler` and optimized the resolver initialization using `AsyncLocal`. This simplifies the code and ensures a more efficient handling of reference resolution during serialization.
2025-01-06 17:57:05 +01:00
Sipke Schoorstra a3ce523faa Fix missing base method call in ApplyOptions implementation
The `ApplyOptions` method now correctly calls the base implementation before applying custom configurations. This ensures that any base behavior is preserved, preventing potential issues with serialization options.
2025-01-06 17:27:24 +01:00
Sipke Schoorstra d2777f70de Refactor reference handling to use a wrapper class
Replaced direct use of `CrossScopedReferenceHandler` with `PerCallReferenceHandlerWrapper` for improved abstraction and reusability. Updated `ApplyOptions` to leverage the new wrapper, simplifying reference resolver management. Commented out redundant code to streamline the implementation.
2025-01-06 17:13:20 +01:00
Sipke Schoorstra 506a36574b Update target framework to .NET 9 and improve null handling
Updated the target framework from .NET 8 to .NET 9 for future compatibility and language improvements. Adjusted null handling in `WorkflowDefinitionImporter` for better readability and correctness. Added a cancellation token to `ReadToEndAsync` for improved async operation control.
2025-01-06 15:35:06 +01:00
Sipke Schoorstra ba4645ea62 Refactor JsonWorkflowStateSerializer to improve performance
- **Improves performance:** The converters and static properties are pre-configured when the class is initialized. Only the `ReferenceHandler` is refreshed per call, avoiding repeated configuration of common options like converters.
- **Thread-safe:** Since `_cachedOptions` is immutable, it can safely be reused across threads.

**Tradeoffs:** Small performance cost during cloning, but still much faster than fully recreating options each time.
2025-01-06 15:34:43 +01:00
Sipke Schoorstra 965a67c62f Fix punctuation in link text for better clarity.
Added a missing comma in the README link text for the Elsa 2 section to improve readability and align with proper punctuation standards. No functional changes were made.
2025-01-05 20:29:08 +01:00
Sipke Schoorstra 106c335918
Merge pull request #6260 from elsa-workflows/bug/6258
Refactor workflow runtime structure and update handlers
2025-01-02 11:48:31 +01:00
Sipke Schoorstra 9aeacd6e4d Update workflow state persistence during cancellation
Enhanced the workflow cancellation process by saving the updated workflow state using `IWorkflowInstanceManager`. Similar updates were applied to state import logic to ensure consistency in persisting workflow state changes.
2025-01-02 11:45:49 +01:00
Sipke Schoorstra 5e2644f751 Refactor workflow runtime structure and update handlers.
Moved `CancelWorkflowsCommandHandler` to the shared runtime module. Updated related project references, features, and configurations accordingly. Improved `WorkflowInstance` actor to save state using `IWorkflowInstanceManager`.
2025-01-02 11:43:21 +01:00
Sipke Schoorstra be68b4c33f
Merge pull request #6259 from elsa-workflows/bug/6251
Refactor recurring tasks scheduling logic.
2025-01-02 11:12:45 +01:00
Sipke Schoorstra 6c0f7a48e7 Refactor recurring tasks scheduling logic.
Removed `ConfigureRecurringTasksScheduleStartupTask` and moved its functionality into `RecurringTaskScheduleManager`. Simplified recurring task configuration and streamlined dependencies, improving maintainability. Added retention policies to `Elsa.Server.Web`.
2025-01-02 11:11:42 +01:00
Sipke Schoorstra d3af106c32
Merge pull request #6256 from elsa-workflows/bug/6255
Handle exceptions in variable loading and fix type checking.
2025-01-01 22:08:33 +01:00
Sipke Schoorstra fdd71f8007 Handle exceptions in variable loading and fix type checking.
Added try-catch block to log failures when reading variables from storage, ensuring robust error handling. Also refined type checking for `ExpandoObject` deserialization in `ObjectConverter` to prevent invalid operations.
2025-01-01 22:07:49 +01:00
Sipke Schoorstra adf2a672b8 Restore .NET 8 packages
Updated `UseElsaMySql` method to use default `null` values instead of `default` and added a conditional compilation directive for `.NET 9.0`. Also introduced new package versions for targeting `.NET 8.0` and `.NET 9.0` to ensure compatibility and maintainability.
2025-01-01 18:18:48 +01:00
Sipke Schoorstra 9828737ad0 Add validation for null factory types and missing type strings
Ensure `WorkerManager` and `TypeTypeConverter` handle invalid inputs gracefully by throwing exceptions. This prevents potential runtime issues caused by null factory types or unresolved type strings.
2025-01-01 18:18:02 +01:00
Sipke Schoorstra e07ece5875 Regenerate EF Core migrations for Runtime 2024-12-31 13:54:19 +01:00
Sipke Schoorstra c5bf6fd0e3 Switch database provider to SQLite
Updated the `DatabaseProvider` setting in `appsettings.json` from MySQL to SQLite. This change likely simplifies development or testing by using a lightweight, file-based database.
2024-12-28 20:07:50 +01:00
Sipke Schoorstra 4ed58c67e6 Enable primitive collections and refactor MySQL EF options.
Added support for primitive collections and parameterized collection translation in MySQL EF configurations. Removed redundant `EnablePrimitiveCollectionsSupport` calls in program configuration to centralize the behavior.
2024-12-28 20:06:33 +01:00
Sipke Schoorstra 021795f53a Enable MySQL primitive collections support and update configs
Add support for EF Core primitive collections in MySQL by specifying `EnablePrimitiveCollectionsSupport()` in the DbContext configuration. Updated the Docker Compose file to rename the MySQL volume and adjusted appsettings.json to include a MySQL connection string and set MySQL as the default database provider.
2024-12-28 18:56:29 +01:00
Sipke Schoorstra 470399ed21 Refine trigger replacement logic with empty check.
Added a check to avoid unnecessary operations when the removed list is empty in the ReplaceAsync method. This prevents potential redundant calls and ensures more efficient execution.
2024-12-28 18:55:28 +01:00
Sipke Schoorstra 2f1ddb4358
Merge pull request #6248 from elsa-workflows/bug/6247
Add support for ExpandoObject deserialization in ObjectConverter
2024-12-28 14:23:34 +01:00
Sipke Schoorstra 28d8f2fcee
Merge pull request #6244 from SergerGood/main
Added example of perfomance test
2024-12-28 14:15:29 +01:00
Sipke Schoorstra afa51f85fa Add support for ExpandoObject deserialization in ObjectConverter
This update enables deserialization of JSON nodes into ExpandoObject via ObjectConverter. It improves type handling and interoperability with dynamic structures.
2024-12-28 14:13:32 +01:00
Sipke Schoorstra 406975f64e Refactor BaseUrl and ApiUrl configuration handling.
Updated to use `Http:BaseUrl` for backward compatibility with `Hosting:BaseUrl`. Simplified ApiUrl construction by removing redundant configuration keys and standardizing the behavior using `ApiPrefix`.
2024-12-28 11:15:50 +01:00
Sipke Schoorstra 07c46ae5a7 Refactor configuration to use distinct ApiUrl and BaseUrl
Updated to separate ApiUrl from BaseUrl in appsettings for clarity. Modified references in _Host.cshtml and Program.cs accordingly to streamline configuration and reduce potential for errors.
2024-12-28 11:04:38 +01:00
Sipke Schoorstra 710fe87117 Update Elsa Studio package reference 2024-12-28 10:17:15 +01:00
sergergood 3e76e3efb0 Added example of perfomance test 2024-12-27 18:57:22 +03:00
Sipke Schoorstra 59e131f1a3 Set DatabaseProvider to SQLite in appsettings.json
Switched the default database provider from PostgreSQL to SQLite in the appsettings.json configuration file. This change enables the application to use SQLite for its database operations.
2024-12-26 12:02:54 +01:00
Sipke Schoorstra 62df21cbaf Make StringData property nullable in WorkflowDefinition
Updated the `StringData` property to allow null values, improving flexibility and aligning with usage scenarios where the property may not always contain a value. This change ensures better handling of optional data.
2024-12-26 11:52:36 +01:00
Sipke Schoorstra 0992404d96 Add integration test for workflow serialization
Introduce a new integration test to verify workflow serialization functionality, ensuring that newly created workflow definitions can be serialized and deserialized correctly. Adjust default nullability for certain fields in `WorkflowDefinition` to improve consistency and prevent null reference issues. Minor argument update in `New` method of `WorkflowDefinitionPublisher`.
2024-12-26 11:17:54 +01:00
Sipke Schoorstra 5f3623aa0b
Merge pull request #6233 from elsa-workflows/chore/drop_net60_update_packages
Drop .NET 6 Support
2024-12-22 10:24:47 +01:00
Sipke Schoorstra ba983e042c Refactor Directory.Packages.props for consistent formatting
Reformatted the `Directory.Packages.props` file to improve readability and ensure consistent indentation. This change has no impact on functionality but enhances maintainability and code clarity.
2024-12-22 10:06:55 +01:00
Sipke Schoorstra 76d685744d Update target frameworks and package versions to latest
Dropped .NET 6 support and upgraded projects to .NET 8 and .NET 9 frameworks. Updated several package dependencies to their latest stable or preview versions to ensure compatibility and leverage improvements.
2024-12-22 10:00:56 +01:00
Sipke Schoorstra 621c298126
Merge pull request #6218 from SergerGood/main
Call async methods when in an async method
2024-12-22 08:47:56 +01:00
Sipke Schoorstra e39f671bcc Update release types in GitHub Actions workflow
Added 'published' to the release type triggers in the packages.yml file. This ensures workflows are triggered for both prereleased and published release events.
2024-12-21 08:37:38 +01:00
Sipke Schoorstra 83ca55a68d
Merge pull request #6217 from mathijs-dumon/main
Fix for #6082 - dropdowns are not populated for inputs without UIHints
2024-12-18 18:53:50 +01:00
Sergei Khlebnikov 8583da9b5f
Merge branch 'elsa-workflows:main' into main 2024-12-16 22:58:04 +03:00
sergergood 311b792f9b Call async methods when in an async method 2024-12-16 22:57:11 +03:00
Mathijs Dumon c25ef53dcc Fix for #6082 - dropdowns are not populated for inputs without UIHints 2024-12-16 16:15:58 +01:00
Sipke Schoorstra 5d92c5760f
Merge pull request #6213 from elsa-workflows/bug/6170
Refactor activity cancellation and bookmark handling.
2024-12-14 21:09:15 +01:00
Sipke Schoorstra a1652f3f23 Refactor activity cancellation and bookmark handling.
Added logic to cancel child activities during activity cancellation. Removed redundant bookmark removal logic in the `Fork` activity for better clarity and efficiency.
2024-12-14 21:02:14 +01:00
Sipke Schoorstra 4770c21604 Refactor DispatchWorkflows tests and skip flaky test.
Removed unused workflow event handlers and simplified signal usage. Marked the flaky `DispatchAndWaitWorkflow_ShouldWaitForChildWorkflowToComplete` test for review and fixing. This improves maintainability and prepares for future test stability work.
2024-12-14 20:30:27 +01:00
Sipke Schoorstra b99c0c8412 Disable flaky test in BulkDispatchWorkflowsTests.
Commented out a test that was marked as flaky and skipped. This ensures the test suite remains reliable while the issue is addressed in the future.
2024-12-14 20:01:11 +01:00
Sipke Schoorstra a44f082dff Merge remote-tracking branch 'origin/main' 2024-12-14 19:41:05 +01:00
Sipke Schoorstra bd9e006900 Skip flaky BulkDispatchWorkflows test temporarily
The test 'DispatchAndWaitWorkflow_ShouldWaitForChildWorkflowToComplete' was marked as flaky and skipped to prevent instability in the suite. It should be revisited and fixed to ensure reliable execution.
2024-12-14 19:40:44 +01:00
Sipke Schoorstra 83ccbca0e9
Merge pull request #6211 from Sverre-W/retention-sweep-interval
Retention: Allow to define cleanup strategy for workflow instances
2024-12-14 19:36:29 +01:00
Sipke Schoorstra cb6a7dfc11 Update RabbitMQ image to version 4-management
Upgraded RabbitMQ from version 3-management to 4-management across tests and the Docker setup. This ensures compatibility with the latest features and improvements in RabbitMQ while maintaining consistency across environments.
2024-12-14 11:44:52 +01:00