fix(server): offload cron job listing from dashboard event loop - #50978
Closed
PINKIIILQWQ wants to merge 1 commit into
Closed
fix(server): offload cron job listing from dashboard event loop#50978PINKIIILQWQ wants to merge 1 commit into
PINKIIILQWQ wants to merge 1 commit into
Conversation
PINKIIILQWQ
force-pushed
the
fix/45072-cron-event-loop-offload
branch
from
June 22, 2026 18:42
f9a0c12 to
cf89262
Compare
18 tasks
This was referenced Jul 30, 2026
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.
What does this PR do?
GET /api/cron/jobsis an async dashboard endpoint, but it performs synchronous profile enumeration and per-profile cron file I/O inline. If those filesystem operations become slow, the dashboard event loop is blocked and other HTTP/WS traffic can be starved during Desktop boot.This PR offloads only the synchronous cron/profile work to
asyncio.to_thread(...):_cron_profile_dicts()_call_cron_for_profile(...)The handler shape, response format, profile parameter behavior, and error handling are preserved.
Why?
This is a small defensive fix for the broader issue tracked in #45072.
It complements #44930: that PR removes a concrete slow profile alias scan, while this PR prevents the cron jobs endpoint from freezing the dashboard event loop if synchronous profile/cron I/O becomes slow again.
What this does not change
Tests
list_cron_jobs()is running.Risk
Low. The offloaded functions are synchronous profile/cron operations and do not access request, WebSocket, or event-loop objects. The cron path already serializes profile-local cron module access via
_CRON_PROFILE_LOCK.Related: #45072