Reduce bookmark scheduling backlog startup latency#7730
Open
sfmskywalker wants to merge 5 commits into
Open
Conversation
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.
Summary
This PR addresses the sequential scheduling bottleneck reported in #7470 for the
release/3.8.0branch.DefaultBookmarkSchedulerstill awaits bookmark scheduling completion and preserves the existing public API/behavior, but it now schedules eligible bookmarks with bounded concurrency instead of awaiting eachScheduleAtAsync/ScheduleCronAsynccall serially. The concurrency is capped at 16 operations to avoid turning large bookmark backlogs into unbounded scheduler pressure.This is intentionally narrower than #7524: it does not make tenant activation fire-and-forget and does not move scheduling into a background worker.
Verification
dotnet test test/unit/Elsa.Scheduling.UnitTests/Elsa.Scheduling.UnitTests.csproj --filter FullyQualifiedName~DefaultBookmarkSchedulerTestsRisk
Residual startup blocking can still exist for very large backlogs because scheduling remains awaited. A dedicated background scheduling/recovery worker may still be the better long-term design if host readiness must be fully decoupled from schedule restoration.