Skip to content

Commit

Permalink
#31 - bugfix: respect retry_limit configuration parameter (#32)
Browse files Browse the repository at this point in the history
#31 - bugfix: respect retry_limit configuration parameter

configuration setting was never sent to ScheduledExecutor
  • Loading branch information
rarruda committed May 5, 2020
1 parent 6c37aec commit 56c1ca8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Argument | Description | Required? | Type | Default Value|
`disable_metrics` | Disables sending metrics to Unleash server. | N | Boolean | `false` |
`custom_http_headers` | Custom headers to send to Unleash. | N | Hash | {} |
`timeout` | How long to wait for the connection to be established or wait in reading state (open_timeout/read_timeout) | N | Integer | 30 |
`retry_limit` | How many consecutive failures in connecting to the Unleash server are allowed before giving up. | N | Integer | 1 |
`retry_limit` | How many consecutive failures in connecting to the Unleash server are allowed before giving up. Use `Float::INFINITY` if you would like it to never give up. | N | Numeric | 5 |
`backup_file` | Filename to store the last known state from the Unleash server. Best to not change this from the default. | N | String | `Dir.tmpdir + "/unleash-#{app_name}-repo.json` |
`logger` | Specify a custom `Logger` class to handle logs for the Unleash client. | N | Class | `Logger.new(STDOUT)` |
`log_level` | Change the log level for the `Logger` class. Constant from `Logger::Severity`. | N | Constant | `Logger::ERROR` |
Expand Down
12 changes: 10 additions & 2 deletions lib/unleash/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,11 @@ def info

def start_toggle_fetcher
Unleash.toggle_fetcher = Unleash::ToggleFetcher.new
self.fetcher_scheduled_executor = Unleash::ScheduledExecutor.new('ToggleFetcher', Unleash.configuration.refresh_interval)
self.fetcher_scheduled_executor = Unleash::ScheduledExecutor.new(
'ToggleFetcher',
Unleash.configuration.refresh_interval,
Unleash.configuration.retry_limit
)
self.fetcher_scheduled_executor.run do
Unleash.toggle_fetcher.fetch
end
Expand All @@ -125,7 +129,11 @@ def start_toggle_fetcher
def start_metrics
Unleash.toggle_metrics = Unleash::Metrics.new
Unleash.reporter = Unleash::MetricsReporter.new
self.metrics_scheduled_executor = Unleash::ScheduledExecutor.new('MetricsReporter', Unleash.configuration.metrics_interval)
self.metrics_scheduled_executor = Unleash::ScheduledExecutor.new(
'MetricsReporter',
Unleash.configuration.metrics_interval,
Unleash.configuration.retry_limit
)
self.metrics_scheduled_executor.run do
Unleash.reporter.send
end
Expand Down

0 comments on commit 56c1ca8

Please sign in to comment.