Skip to content
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

[DOP-14025] Remove asyncio.gather from SQLAlchemy requests #40

Merged
merged 1 commit into from
Apr 22, 2024

Conversation

dolfinus
Copy link
Member

@dolfinus dolfinus commented Apr 19, 2024

Change Summary

Using asyncio.gather with SQLAlchemy may result some unexpected errors: sqlalchemy/sqlalchemy#9312. We should avoid using it.

Also even asyncio.gather is still expensive because each for loop iteration sends a separated query to the database. Replaced it with connection_id IN (...) clause, reducing to just one database request.

Related issue number

Checklist

  • Commit message and PR title is comprehensive
  • Keep the change as small as possible
  • Unit and integration tests for the changes exist
  • Tests pass on CI and coverage does not decrease
  • Documentation reflects the changes where applicable
  • docs/changelog/next_release/<pull request or issue id>.<change type>.rst file added describing change
    (see CONTRIBUTING.rst for details.)
  • My PR is ready to review.

@dolfinus dolfinus self-assigned this Apr 19, 2024
@dolfinus dolfinus force-pushed the bugfix/eliminate-gather branch from 51de1c7 to 45cd542 Compare April 19, 2024 11:50
Copy link

codecov bot commented Apr 19, 2024

Codecov Report

Attention: Patch coverage is 85.71429% with 5 lines in your changes are missing coverage. Please review.

Project coverage is 91.88%. Comparing base (3932c3c) to head (f0ba198).
Report is 1 commits behind head on develop.

❗ Current head f0ba198 differs from pull request most recent head 965177b. Consider uploading reports for the commit 965177b to get more accurate results

Files Patch % Lines
syncmaster/backend/api/v1/transfers/router.py 54.54% 2 Missing and 3 partials ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop      #40      +/-   ##
===========================================
+ Coverage    91.73%   91.88%   +0.15%     
===========================================
  Files           84       84              
  Lines         2445     2441       -4     
  Branches       305      307       +2     
===========================================
  Hits          2243     2243              
+ Misses         145      140       -5     
- Partials        57       58       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dolfinus dolfinus force-pushed the bugfix/eliminate-gather branch from 45cd542 to c4bc7e1 Compare April 19, 2024 12:53
@dolfinus dolfinus requested review from dmitry-pedchenko and maxim-lixakov and removed request for dmitry-pedchenko and maxim-lixakov April 19, 2024 12:54
@dolfinus dolfinus force-pushed the bugfix/eliminate-gather branch from c4bc7e1 to f0ba198 Compare April 19, 2024 13:38
@dolfinus dolfinus marked this pull request as ready for review April 19, 2024 13:52
@dolfinus dolfinus force-pushed the bugfix/eliminate-gather branch from f0ba198 to 965177b Compare April 22, 2024 08:29
@dolfinus dolfinus merged commit 2a5d95f into develop Apr 22, 2024
13 checks passed
@dolfinus dolfinus deleted the bugfix/eliminate-gather branch April 22, 2024 08:31
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.

2 participants