Module: QueueKit::Clients::CommandTimeout
- Defined in:
- lib/queue_kit/clients/command_timeout.rb
Instance Method Summary collapse
- #command_clients_size ⇒ Object
- #command_timeout(attempts = 0) ⇒ Object
- #command_timeout_from(options) ⇒ Object
- #command_timeout_ms ⇒ Object
- #max_command_timeout_ms ⇒ Object
Instance Method Details
#command_clients_size ⇒ Object
28 29 30 |
# File 'lib/queue_kit/clients/command_timeout.rb', line 28 def command_clients_size 1 end |
#command_timeout(attempts = 0) ⇒ Object
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/queue_kit/clients/command_timeout.rb', line 4 def command_timeout(attempts = 0) timeout = command_timeout_ms timeout += timeout * (attempts / command_clients_size).floor if timeout > (max = max_command_timeout_ms) timeout = max end timeout end |
#command_timeout_from(options) ⇒ Object
15 16 17 18 |
# File 'lib/queue_kit/clients/command_timeout.rb', line 15 def command_timeout_from() @command_timeout_ms = [:command_timeout_ms] @max_command_timeout_ms = [:max_command_timeout_ms] end |
#command_timeout_ms ⇒ Object
20 21 22 |
# File 'lib/queue_kit/clients/command_timeout.rb', line 20 def command_timeout_ms @command_timeout_ms ||= 10 end |
#max_command_timeout_ms ⇒ Object
24 25 26 |
# File 'lib/queue_kit/clients/command_timeout.rb', line 24 def max_command_timeout_ms @max_command_timeout_ms ||= 1000 end |