Harden Quartz.NET integration for clustered deployments - #110
Merged
sfmskywalker merged 7 commits intoDec 30, 2025
Conversation
…ation Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>
Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Enhance and document Quartz.NET clustering support
Harden Quartz.NET integration for clustered deployments
Dec 29, 2025
sfmskywalker
marked this pull request as ready for review
December 29, 2025 08:49
Contributor
There was a problem hiding this comment.
Pull request overview
This PR hardens the Quartz.NET integration for safe operation in clustered Kubernetes deployments by eliminating race conditions during concurrent job and trigger registration. The changes introduce a convenience method for clustering configuration and replace check-then-act patterns with idempotent try-catch error handling.
- Added
EnableClustering()convenience method to simplify cluster configuration - Fixed race conditions in job registration by handling
ObjectAlreadyExistsException - Fixed race conditions in trigger scheduling by handling
ObjectAlreadyExistsException
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
src/modules/scheduling/Elsa.Scheduling.Quartz/Features/QuartzFeature.cs |
Adds EnableClustering() method to configure scheduler ID and name for cluster coordination |
src/modules/scheduling/Elsa.Scheduling.Quartz/Tasks/RegisterJobsTask.cs |
Replaces check-then-act with try-catch pattern to handle concurrent job registration safely |
src/modules/scheduling/Elsa.Scheduling.Quartz/Services/QuartzWorkflowScheduler.cs |
Replaces check-then-act with try-catch pattern to handle concurrent trigger scheduling safely |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ew feedback Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>
…stering param to SQLite Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>
…lues if not explicitly set.
…uration and provide usage examples
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Plan: Harden and Enable Quartz.NET Clustering Support ✅
ConfigureClusteringIdentitymethod toQuartzFeaturewith sensible defaults (renamed fromEnableClustering)instanceId = AUTOand scheduler name for cluster-safe operationRegisterJobsTask.csto handleObjectAlreadyExistsExceptionQuartzWorkflowScheduler.csto handleObjectAlreadyExistsExceptionuseClusteringparameter to SQLite extension (defaults tofalse)true)Summary
All required changes have been implemented successfully, including addressing PR review feedback:
1. ConfigureClusteringIdentity Convenience API (renamed from EnableClustering)
QuartzFeatureclassSchedulerId = "AUTO"andSchedulerName = "ElsaScheduler"by default2. Race Condition Fixes
ObjectAlreadyExistsExceptiongracefully with visibility3. EFCore Extensions Updated
useClusteringparameter (defaults tofalsefor backwards compatibility)useClusteringparameter (defaults totrue)4. Review Feedback Addressed
EnableClusteringtoConfigureClusteringIdentityto better reflect functionalityuseClusteringparameter to SQLite extension5. Security Summary
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.