Skip to content

Commit

Permalink
#31 - bugfix: respect retry_limit configuration parameter
Browse files Browse the repository at this point in the history
configuration setting was never sent to ScheduledExecutor
  • Loading branch information
rarruda committed Apr 14, 2020
1 parent 92ca4e5 commit 26c5dc6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
9 changes: 4 additions & 5 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# inherit_from: .rubocop_todo.yml

AllCops:
TargetRubyVersion: 2.4

Naming/PredicateName:
NameWhitelist:
AllowedMethods:
- is_enabled?

Metrics/ClassLength:
Expand Down Expand Up @@ -42,10 +45,6 @@ Style/FrozenStringLiteralComment:
Style/GuardClause:
MinBodyLength: 8

Style/BracesAroundHashParameters:
Exclude:
- 'spec/**/*.rb'

Style/IfInsideElse:
Exclude:
- 'bin/unleash-client'
Expand Down
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. | N | Integer | 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 26c5dc6

Please sign in to comment.