fix: use Dispatchers.IO for EventHandler coroutines#516
Merged
torlando-tech merged 1 commit intomainfrom Feb 21, 2026
Merged
Conversation
3 tasks
Contributor
Greptile SummaryFixes a critical thread starvation issue by switching EventHandler coroutines from The changes are:
All three operations involve database persistence ( Confidence Score: 5/5
Important Files Changed
Last reviewed commit: 3809cd4 |
Contributor
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
… starvation EventHandler's scope.launch inherited Dispatchers.Default from the service scope, which has only max(2, numCPU) threads. During heavy operations like large file propagation, all Default threads could become saturated, causing message processing coroutines to queue indefinitely without executing. Switch to Dispatchers.IO (scales to 64 threads) for all EventHandler coroutines that perform database I/O via Room and Python wrapper calls. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
3809cd4 to
dd6d259
Compare
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
scope.launchinheritedDispatchers.Defaultfrom the service scope, which has onlymax(2, numCPU)threadsscope.launchcalls in EventHandler toDispatchers.IO(scales to 64 threads), which is appropriate for database I/O and Python wrapper callsTest plan
"Message coroutine started on DefaultDispatcher-worker-..."confirming the coroutine body executes🤖 Generated with Claude Code