Sha256: 39b83595f1a658c6a2d10eb72d730ec59ade73d5f35caeddddb19f012675e061

Contents?: true

Size: 491 Bytes

Versions: 7

Compression:

Stored size: 491 Bytes

Contents

module Resque
  module Plugins
    class MultiStepTask
      module AtomicCounters
        def counter(name)
          class_eval <<-INCR
            def increment_#{name}
              redis.incrby('#{name}', 1)
              logger.info("[Resque Multi-Step-Task] Incremented #{name}")
            end
            INCR

          class_eval <<-GETTER
            def #{name}
              redis.get('#{name}').to_i
            end
            GETTER
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
resque-multi-step-2.0.9 lib/resque/plugins/multi_step_task/atomic_counters.rb
resque-multi-step-2.0.8 lib/resque/plugins/multi_step_task/atomic_counters.rb
resque-multi-step-2.0.6 lib/resque/plugins/multi_step_task/atomic_counters.rb
resque-multi-step-2.0.5 lib/resque/plugins/multi_step_task/atomic_counters.rb
resque-multi-step-2.0.4 lib/resque/plugins/multi_step_task/atomic_counters.rb
resque-multi-step-2.0.3 lib/resque/plugins/multi_step_task/atomic_counters.rb
resque-multi-step-2.0.2 lib/resque/plugins/multi_step_task/atomic_counters.rb