feat(cli): add event loop factory option - #660
Open
Davixk wants to merge 1 commit 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.
Closes #659.
Summary
--loop-factory module:callableto the worker and scheduler CLIMotivation
Some integrations require a specific event loop implementation. For example, async Psycopg on Windows requires a selector-based loop instead of the default
ProactorEventLoop.Applications can currently influence TaskIQ-created loops through process-wide asyncio policies, but those policies are deprecated in Python 3.14 and scheduled for removal in Python 3.16.
This provides a generic application-controlled mechanism and a forward-compatible alternative for the Windows compatibility case discussed in #641, without changing TaskIQ's default loop on any platform.
Compatibility
The scheduler uses AnyIO's
loop_factorybackend option so the feature remains compatible with TaskIQ's Python 3.10 minimum. The worker keeps its existing loop lifecycle and changes only how the loop is selected.