Sha256: 24e7f70ed1aa99c129d678a089142304e0906b1e639ae5f38304092a35afe798

Contents?: true

Size: 376 Bytes

Versions: 5

Compression:

Stored size: 376 Bytes

Contents

class StatsThread
  PERIOD = 60
  
  def initialize
    @processed = 0
    @running = true
    Thread.new do
      while @running
        sleep(PERIOD)
        puts "Processed #{@processed} tasks"
        @processed = 0
      end
    end
  end
  
  def stop
    @running = false
  end
  
  def kill
    @thread.kill
  end
  
  def processed_task
    @processed += 1
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
yodel-0.0.7 lib/yodel/task_queue/stats_thread.rb
yodel-0.0.4 lib/yodel/task_queue/stats_thread.rb
yodel-0.0.3 lib/yodel/task_queue/stats_thread.rb
yodel-0.0.2 lib/yodel/task_queue/stats_thread.rb
yodel-0.0.1 lib/yodel/task_queue/stats_thread.rb