lib/good_job/lockable.rb in good_job-1.10.0 vs lib/good_job/lockable.rb in good_job-1.10.1
- old
+ new
@@ -46,18 +46,12 @@
else
''
end
composed_cte = Arel::Nodes::As.new(cte_table, Arel::Nodes::SqlLiteral.new([cte_type, "(", cte_query.to_sql, ")"].join(' ')))
-
- # In addition to an advisory lock, there is also a FOR UPDATE SKIP LOCKED
- # because this causes the query to skip jobs that were completed (and deleted)
- # by another session in the time since the table snapshot was taken.
- # In rare cases under high concurrency levels, leaving this out can result in double executions.
query = cte_table.project(cte_table[:id])
.with(composed_cte)
.where(Arel.sql(sanitize_sql_for_conditions(["#{function}(('x' || substr(md5(:table_name || #{connection.quote_table_name(cte_table.name)}.#{connection.quote_column_name(column)}::text), 1, 16))::bit(64)::bigint)", { table_name: table_name }])))
- .lock(Arel.sql("FOR UPDATE SKIP LOCKED"))
limit = original_query.arel.ast.limit
query.limit = limit.value if limit.present?
unscoped.where(arel_table[primary_key].in(query)).merge(original_query.only(:order))