Class: Drnbench::PublishSubscribe::Runner
- Inherits:
-
Object
- Object
- Drnbench::PublishSubscribe::Runner
- Defined in:
- lib/drnbench/publish-subscribe/runner.rb
Instance Method Summary collapse
- #increase_subscribers ⇒ Object
-
#initialize(config) ⇒ Runner
constructor
A new instance of Runner.
- #n_subscribers ⇒ Object
- #run ⇒ Object
- #setup ⇒ Object
- #teardown ⇒ Object
Constructor Details
#initialize(config) ⇒ Runner
Returns a new instance of Runner.
24 25 26 27 |
# File 'lib/drnbench/publish-subscribe/runner.rb', line 24 def initialize(config) @config = config @published_messages = Queue.new end |
Instance Method Details
#increase_subscribers ⇒ Object
51 52 53 54 55 56 57 58 59 |
# File 'lib/drnbench/publish-subscribe/runner.rb', line 51 def increase_subscribers if @subscribers.empty? new_n_subscribers = @config.start_n_subscribers else new_n_subscribers = @subscribers.size end add_subscribers(new_n_subscribers) ensure_subscribers_ready end |
#n_subscribers ⇒ Object
29 30 31 |
# File 'lib/drnbench/publish-subscribe/runner.rb', line 29 def n_subscribers @subscribers.size end |
#run ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/drnbench/publish-subscribe/runner.rb', line 43 def run publishing_times = @config.n_publishings = @subscribers.size * publishing_times do_feed(publishing_times) () end |
#setup ⇒ Object
33 34 35 36 |
# File 'lib/drnbench/publish-subscribe/runner.rb', line 33 def setup setup_server setup_subscribers end |
#teardown ⇒ Object
38 39 40 41 |
# File 'lib/drnbench/publish-subscribe/runner.rb', line 38 def teardown teardown_subscribers teardown_server end |