Class: SonyCameraRemoteAPI::Retrying
- Inherits:
-
Object
- Object
- SonyCameraRemoteAPI::Retrying
show all
- Includes:
- Logging
- Defined in:
- lib/sony_camera_remote_api/retrying.rb
Constant Summary
collapse
- RECONNECTION_INTERVAL =
5
- DEFAULT_RETRY_LIMIT =
2
- DEFAULT_RECONNECTION_LIMIT =
2
Instance Method Summary
collapse
Methods included from Logging
configure_logger_for, #log, log_file, logger_for, #set_level, #set_output
Constructor Details
#initialize(reconnect_by, httpclient) ⇒ Retrying
Returns a new instance of Retrying.
12
13
14
15
|
# File 'lib/sony_camera_remote_api/retrying.rb', line 12
def initialize(reconnect_by, httpclient)
@reconnect_by = reconnect_by
@http = httpclient
end
|
Instance Method Details
#add_common_hook(&block) ⇒ Object
36
37
38
39
|
# File 'lib/sony_camera_remote_api/retrying.rb', line 36
def add_common_hook(&block)
@common_hook = block
self
end
|
#reconnect_and_give_up(reconnection_limit: DEFAULT_RECONNECTION_LIMIT, hook: nil, &block) ⇒ Object
25
26
27
28
|
# File 'lib/sony_camera_remote_api/retrying.rb', line 25
def reconnect_and_give_up(reconnection_limit: DEFAULT_RECONNECTION_LIMIT,
hook: nil, &block)
reconnect_and_retry_inner(0, reconnection_limit, hook, &block)
end
|
#reconnect_and_retry(retry_limit: DEFAULT_RETRY_LIMIT, reconnection_limit: DEFAULT_RECONNECTION_LIMIT, hook: nil, &block) ⇒ Object
18
19
20
21
22
|
# File 'lib/sony_camera_remote_api/retrying.rb', line 18
def reconnect_and_retry(retry_limit: DEFAULT_RETRY_LIMIT,
reconnection_limit: DEFAULT_RECONNECTION_LIMIT,
hook: nil, &block)
reconnect_and_retry_inner(retry_limit, reconnection_limit, hook, &block)
end
|
#reconnect_and_retry_forever(hook: nil, &block) ⇒ Object
31
32
33
|
# File 'lib/sony_camera_remote_api/retrying.rb', line 31
def reconnect_and_retry_forever(hook: nil, &block)
reconnect_and_retry_inner(:forever, :forever, hook, &block)
end
|