From a9a00ff9717c55c19cf71f20010691eaebccaf2c Mon Sep 17 00:00:00 2001 From: Sebastian Riedel Date: Mon, 16 Dec 2019 13:01:34 +0100 Subject: [PATCH] Subselects for queries that modify the selected row need to use FOR UPDATE (closes #90) --- Changes | 3 ++- lib/Minion/Backend/Pg.pm | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Changes b/Changes index b6d97629..3bc157f8 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,6 @@ -10.01 2019-11-16 +10.01 2019-12-16 + - Fixed an unlock concurrency issue in Minion::Backend::Pg. 10.0 2019-11-15 - Removed PostgreSQL migrations older than 2 years, that means you need to diff --git a/lib/Minion/Backend/Pg.pm b/lib/Minion/Backend/Pg.pm index 00161063..58c23363 100644 --- a/lib/Minion/Backend/Pg.pm +++ b/lib/Minion/Backend/Pg.pm @@ -271,7 +271,7 @@ sub unlock { !!shift->pg->db->query( 'delete from minion_locks where id = ( select id from minion_locks - where expires > now() and name = ? order by expires limit 1 + where expires > now() and name = ? order by expires limit 1 for update ) returning 1', shift )->rows; }