-
Couldn't load subscription status.
- Fork 21
Fix: remove I/O Blocking code on message processing parts #819
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
+2,379
−1,980
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
… to avoid blocking in case of big file
7520d8b to
2f2d36f
Compare
6 tasks
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.
This PR remove I/O blocking operations on parts used by message processing to bring back message parallelization
Related Clickup or Jira tickets : ALEPH-526
Self proofreading checklist
Changes
This pull request introduces a comprehensive migration from synchronous database session handling to asynchronous session handling across multiple modules in the
alephcodebase. The changes aim to improve performance and scalability by leveraging asynchronous operations. The most important changes include replacingDbSessionFactoryandDbSessionwith their asynchronous counterparts, updating session-related method calls to useasync with, and modifying database operations to useawait.Migration to Asynchronous Database Sessions:
Core API Entrypoint Updates:
make_engineandmake_session_factorywithmake_async_engineandmake_async_session_factoryinsrc/aleph/api_entrypoint.py. Updated session initialization inconfigure_aiohttp_appto use asynchronous methods. [1] [2]Chain-Specific Connector Updates:
DbSessionFactorytoAsyncDbSessionFactoryinsrc/aleph/chains/bsc.py,src/aleph/chains/connector.py,src/aleph/chains/ethereum.py, andsrc/aleph/chains/nuls2.py. Updated constructors and session usage within these chain connectors to use asynchronous operations. [1] [2] [3] [4]Chain Data Service Updates:
DbSessionFactoryandDbSessiontoAsyncDbSessionFactoryandAsyncDbSessioninsrc/aleph/chains/chain_data_service.py. Updated methods likeadd_pending_tx,add_and_publish_pending_tx, and others to useasync withfor session handling and addedawaitfor database operations. [1] [2] [3] [4]Indexer Reader Updates:
DbSessionFactoryandDbSessiontoAsyncDbSessionFactoryandAsyncDbSessioninsrc/aleph/chains/indexer_reader.py. Updated methods such asfetch_range,fetch_new_events, andfetcherto use asynchronous session handling and database operations. [1] [2] [3] [4]Additional Updates:
commit,upsert,get_last_height) to use asynchronous versions withawait. This ensures consistency and compatibility with the asynchronous session handling across the codebase.How to test
This PR doesn't add any breaking change, it's just running things in Non I/O blockign way