Class: SidekiqUtils::Middleware::Server::FindOptional

Inherits:
Object
  • Object
show all
Defined in:
lib/sidekiq_utils/middleware/server/find_optional.rb

Instance Method Summary collapse

Instance Method Details

#call(worker, job, queue) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/sidekiq_utils/middleware/server/find_optional.rb', line 5

def call(worker, job, queue)
  begin
    yield
  rescue SidekiqUtils::FindOptional::NotFoundError
    if queue == 'retry_once'
      # do nothing; this is already the retry and it failed again
    else
      worker.class.set(queue: :retry_once).
        perform_in(30.seconds, *job['args'])
    end
  end
end