Skip to content

feat: Modernize the async routines#1276

Draft
erichare wants to merge 1 commit intoapache:trunkfrom
erichare:feat-async-modernization
Draft

feat: Modernize the async routines#1276
erichare wants to merge 1 commit intoapache:trunkfrom
erichare:feat-async-modernization

Conversation

@erichare
Copy link

This pull request updates the Cassandra driver to make AsyncioConnection the standard fallback event loop implementation, reflecting the removal of asyncore in Python 3.12+. It also removes legacy compatibility checks and improves documentation and testing for the asyncio reactor.

Event loop selection improvements:

  • Updated the connection selection priority to use AsyncioConnection as the preferred fallback after libev, and as the default for Python 3.12+ where asyncore is no longer available. The selection order and documentation were revised accordingly. [1] [2] [3]

Asyncio reactor modernization:

  • Removed outdated compatibility checks for asyncio.run_coroutine_threadsafe and references to "experimental" status, reflecting that AsyncioConnection is now a mainstream option. Updated docstrings to clarify its role and requirements. [1] [2]
  • Fixed coroutine locking in _push_msg to use async with for modern asyncio syntax.
  • Stopped setting the event loop globally in initialize_reactor, avoiding unnecessary side effects.

Testing improvements:

  • Changed the default event loop manager in tests to asyncio and replaced asynctest.TestSelector with MagicMock for selector mocking. Added a new test for multi-timer validation with wider tolerances to account for asyncio's thread-based scheduling jitter. [1] [2] [3] [4]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant