Class: Shoryuken::Middleware::Server::AutoExtendVisibility

Inherits:
Object
  • Object
show all
Includes:
Util
Defined in:
lib/shoryuken/middleware/server/auto_extend_visibility.rb

Defined Under Namespace

Classes: MessageVisibilityExtender

Constant Summary collapse

EXTEND_UPFRONT_SECONDS =
5

Instance Method Summary collapse

Methods included from Util

#elapsed, #fire_event, #logger, #unparse_queues, #worker_name

Instance Method Details

#call(worker, queue, sqs_msg, body) ⇒ Object


9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/shoryuken/middleware/server/auto_extend_visibility.rb', line 9

def call(worker, queue, sqs_msg, body)
  return yield unless worker.class.auto_visibility_timeout?

  if sqs_msg.is_a?(Array)
    logger.warn { "Auto extend visibility isn't supported for batch workers" }
    return yield
  end

  timer = auto_visibility_timer(worker, queue, sqs_msg, body)
  yield
ensure
  timer.kill if timer
end