summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatus Valo <matusvalo@gmail.com>2020-05-03 21:22:26 +0200
committerAsif Saif Uddin <auvipy@gmail.com>2020-05-04 11:18:21 +0600
commit9d28e9908be37df81f34a21eef04e10edacad3ed (patch)
treeaaa852e2e0a757167b583c0e1b1cc20b45233331
parent6a5c3ccfc8977b42ad5380a4fa2bd0d8c3a21024 (diff)
downloadkombu-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__.py2
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) \