-
Notifications
You must be signed in to change notification settings - Fork 30
Harden Quartz.NET integration for clustered deployments #110
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
Harden Quartz.NET integration for clustered deployments #110
Conversation
…ation Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>
Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
src/modules/scheduling/Elsa.Scheduling.Quartz/Services/QuartzWorkflowScheduler.cs
Show resolved
Hide resolved
src/modules/scheduling/Elsa.Scheduling.Quartz/Features/QuartzFeature.cs
Outdated
Show resolved
Hide resolved
src/modules/scheduling/Elsa.Scheduling.Quartz/Services/QuartzWorkflowScheduler.cs
Show resolved
Hide resolved
…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
j03y-nxxbz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good!
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.