Sha256: 194f01103dd7b92104b335985bd6c13bc2cc5b085edd24fefff0f9dcbe09f99e
Contents?: true
Size: 732 Bytes
Versions: 1
Compression:
Stored size: 732 Bytes
Contents
module BunnyCarrot module Strategy class RestartAndBlock < Base def perform if restart_attempts_left? logger.info "Requeuing with attempt: #{@restart_attempt}" acknowledge publish end end protected def post_initialize(args) @restart_count = args.fetch(:restart_count, 5) increase_attempt_count end private def restart_attempts_left? @restart_attempt <= @restart_count end def headers super.merge(Hamster.hash('restart_attempt' => @restart_attempt)) end def increase_attempt_count @restart_attempt = (@headers['restart_attempt'] || 0) + 1 end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bunny_carrot-0.0.2 | lib/bunny_carrot/strategy/restart_and_block.rb |