Class: EventMachine::Scenario::QuantumSatis

Inherits:
Object
  • Object
show all
Includes:
EM::Deferrable
Defined in:
lib/scenario/latin.rb

Overview

As much as enough. You wont lots of parralel workers, but not too much.

Instance Method Summary collapse

Constructor Details

#initialize(times, throttle = nil, &block) ⇒ QuantumSatis

Returns a new instance of QuantumSatis.



77
78
79
80
81
82
83
84
85
# File 'lib/scenario/latin.rb', line 77

def initialize times, throttle=nil, &block
  @opened = 0
  @finished = 0
  @worker = 0
  @times = times
  @throttle = throttle
  @loop = block
  @debug = false
end

Instance Method Details

#finally(&block) ⇒ Object



87
88
89
90
91
92
93
94
# File 'lib/scenario/latin.rb', line 87

def finally &block
  self.callback &block
  if @throttle
    @throttle.times{ call }
  else
    @times.times{ call }
  end
end