From 9d28e9908be37df81f34a21eef04e10edacad3ed Mon Sep 17 00:00:00 2001 From: Matus Valo Date: Sun, 3 May 2020 21:22:26 +0200 Subject: 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. --- kombu/transport/sqlalchemy/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) \ -- cgit v1.2.1