diff options
author | Matus Valo <matusvalo@gmail.com> | 2020-05-03 21:22:26 +0200 |
---|---|---|
committer | Asif Saif Uddin <auvipy@gmail.com> | 2020-05-04 11:18:21 +0600 |
commit | 9d28e9908be37df81f34a21eef04e10edacad3ed (patch) | |
tree | aaa852e2e0a757167b583c0e1b1cc20b45233331 | |
parent | 6a5c3ccfc8977b42ad5380a4fa2bd0d8c3a21024 (diff) | |
download | kombu-9d28e9908be37df81f34a21eef04e10edacad3ed.tar.gz |
SQLAlchemy transport: Use Query.with_for_update() instead of deprecated Query.with_lockmode().
Based on SQLAlchemy documentation:
* method sqlalchemy.orm.query.Query.with_lockmode(mode) with mode='update' - translates to FOR UPDATE (Deprecated since version 0.9)
* method sqlalchemy.orm.query.Query.with_for_update() When called with no arguments, the resulting SELECT statement will have a FOR UPDATE clause appended.
-rw-r--r-- | kombu/transport/sqlalchemy/__init__.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kombu/transport/sqlalchemy/__init__.py b/kombu/transport/sqlalchemy/__init__.py index fe469fae..da34b8f6 100644 --- a/kombu/transport/sqlalchemy/__init__.py +++ b/kombu/transport/sqlalchemy/__init__.py @@ -99,7 +99,7 @@ class Channel(virtual.Channel): self.session.execute('BEGIN IMMEDIATE TRANSACTION') try: msg = self.session.query(self.message_cls) \ - .with_lockmode('update') \ + .with_for_update() \ .filter(self.message_cls.queue_id == obj.id) \ .filter(self.message_cls.visible != False) \ .order_by(self.message_cls.sent_at) \ |