-
-
Notifications
You must be signed in to change notification settings - Fork 63
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
Fix sync/async issues with Asgiref and officialize PsycopgConnector as the default one #753
Merged
Conversation
This file contains 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
eb57a2c
to
f07ff19
Compare
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
47d7a6b
to
a47b7c1
Compare
2578abd
to
c983347
Compare
ea6d605
to
c1d848e
Compare
Also, take into account the new sync/async behaviour
- User _get_cursor to clean json load and dumps - Add get_sync_connector - Rewrite listen_notify (uses a connection out of the pool) - rename self._pool as self._async_pool
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 #751
See #751 (comment)
Breaking changes:
Aiopg
andPsycopg2
connectors are nowcontrib
. To use them, you'll need to import them withfrom procrastinate.contrib.aiopg import AiopgConnector
andfrom procrastinate.contrib.psycopg2 import Psycopg2Connector
. Also, the dependencies toaiopg
andpsycopg2
are now optional: usepip install procrastinate[aiopg]
orpip install procrastinate[psycopg2]
(orpip install procrastinate[aiopg,psycopg2]
for both)PsycopgConnector
that uses Psycopg 3 (andSyncPsycopgConnector
). Please note thatPsycopgConnector
accepts parameters based onpsycopg_pool.ConnectionPool
, which has a slightly different signature from thepsycopg2
/aiopg
counterpart, the main difference is that the connection arguments are now passed asPsycopgConnector(kwargs={"host": "..."})
(instead ofAiopgConnector(host=...)
). Other parameters may have changed too, please check the documentation.PsycopgConnector
(orAiopgConnector
), see if it works with all your existing code and don't hesitate to report potential issues. Synchronous connectors are still available in case you need it, so it should be a workaround in most cases.asgiref.sync_to_async
. That said, because of the Global Interpreter Lock (GIL), CPU-consuming tasks will not run faster with parallelization.JobManager.check_connection
was an async method. It becamecheck_connection_async
for consistency.check_connection
was created a the sync counterpart.Successful PR Checklist:
Todolist
procrastinate
directly. Add wrappers to make the error explicit