Skip to content

Commit

Permalink
remove not reachable code
Browse files Browse the repository at this point in the history
  • Loading branch information
ankithads committed Sep 3, 2024
1 parent 7d136d8 commit 669a095
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 1 addition & 3 deletions lib/que/adapters/active_record_with_lock.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
module Que
module Adapters
class ActiveRecordWithLock < Que::Adapters::ActiveRecord
class NoLockableJobs < StandardError; end
FindJobSecondsTotal = Prometheus::Client::Counter.new(
:que_find_job_seconds_total,
docstring: "Seconds spent finding a job",
Expand Down Expand Up @@ -50,7 +49,7 @@ def execute(command, params = [])
def lock_job_with_lock_database(queue, cursor)
loop do
observe(duration_metric: FindJobSecondsTotal, labels: { queue: queue }) do
locked_job = Que.transaction do
Que.transaction do
job_to_lock = Que.execute(:find_job_to_lock, [queue, cursor])

return job_to_lock if job_to_lock.empty?
Expand All @@ -61,7 +60,6 @@ def lock_job_with_lock_database(queue, cursor)
observe(count_metric: FindJobHitTotal, labels: { queue: queue, job_hit: job_locked })
return job_to_lock if job_locked
end
return locked_job if locked_job
end
end
end
Expand Down
3 changes: 3 additions & 0 deletions spec/lib/que/adapters/active_record_with_lock_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
Que.adapter.tap do |old_adapter|
# We need this to avoid errors related to prepared statements
if old_adapter.class != described_class

puts "old_adapter #{old_adapter.class}"
puts "new adapter #{adapter.class}"
Que.adapter = adapter
example.run
Que.adapter = old_adapter
Expand Down

0 comments on commit 669a095

Please sign in to comment.