Sha256: 66a1001963a33c89dd6d092901e57b4f6969a75f6356aee044d5e957fa4d8ae7

Contents?: true

Size: 760 Bytes

Versions: 4

Compression:

Stored size: 760 Bytes

Contents

module Shoryuken
  module Middleware
    module Server
      class Timing
        include Util

        def call(worker, queue, sqs_msg, body)
          begin
            started_at = Time.now

            logger.info { "started at #{started_at}" }

            yield

            total_time = elapsed(started_at)

            if (total_time / 1000.0) > (timeout = Shoryuken::Client.queues(queue).visibility_timeout)
              logger.warn { "exceeded the queue visibility timeout by #{total_time - (timeout * 1000)} ms" }
            end

            logger.info { "completed in: #{total_time} ms" }
          rescue
            logger.info { "failed in: #{elapsed(started_at)} ms" }
            raise
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
shoryuken-3.2.3 lib/shoryuken/middleware/server/timing.rb
shoryuken-3.2.2 lib/shoryuken/middleware/server/timing.rb
shoryuken-3.2.1 lib/shoryuken/middleware/server/timing.rb
shoryuken-3.2.0 lib/shoryuken/middleware/server/timing.rb