diff --git a/src/storage/postgres/prg_pg_backend.erl b/src/storage/postgres/prg_pg_backend.erl index ee3ca84..9720b18 100644 --- a/src/storage/postgres/prg_pg_backend.erl +++ b/src/storage/postgres/prg_pg_backend.erl @@ -350,7 +350,7 @@ capture_task(PgOpts, NsId, TaskId) -> epg_pool:query( Connection, "WITH current_task AS (SELECT * FROM " ++ ScheduleTable ++ - " WHERE task_id = $2 FOR UPDATE), " + " WHERE task_id = $2 AND status = 'waiting' FOR UPDATE), " "deleted_from_schedule AS (" " DELETE FROM " ++ ScheduleTable ++ " WHERE task_id = $2 AND status = 'waiting' "