Class: SettingsReader::VaultResolver::RefresherObserver
- Inherits:
-
Object
- Object
- SettingsReader::VaultResolver::RefresherObserver
- Defined in:
- lib/settings_reader/vault_resolver/refresher_observer.rb
Overview
Check lease refresh result and report problems if needed
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
-
#initialize(config) ⇒ RefresherObserver
constructor
A new instance of RefresherObserver.
- #notify_error(result) ⇒ Object
- #notify_success(result) ⇒ Object
- #update(_time, result, error) ⇒ Object
Constructor Details
#initialize(config) ⇒ RefresherObserver
Returns a new instance of RefresherObserver.
7 8 9 |
# File 'lib/settings_reader/vault_resolver/refresher_observer.rb', line 7 def initialize(config) @config = config end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
5 6 7 |
# File 'lib/settings_reader/vault_resolver/refresher_observer.rb', line 5 def config @config end |
Instance Method Details
#notify_error(result) ⇒ Object
25 26 27 |
# File 'lib/settings_reader/vault_resolver/refresher_observer.rb', line 25 def notify_error(result) config.lease_renew_error_listener.call(result) end |
#notify_success(result) ⇒ Object
21 22 23 |
# File 'lib/settings_reader/vault_resolver/refresher_observer.rb', line 21 def notify_success(result) config.lease_renew_success_listener.call(result) end |
#update(_time, result, error) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/settings_reader/vault_resolver/refresher_observer.rb', line 11 def update(_time, result, error) if result result.map do |promise| promise.on_success(&method(:notify_success)).on_error(&method(:notify_error)) end.each(&:wait) else notify_error(error) end end |