diff options
author | Bob Van Landuyt <bob@vanlanduyt.co> | 2017-10-19 08:32:55 +0200 |
---|---|---|
committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2017-10-23 12:02:23 +0300 |
commit | 430e7671397a1c022b88da31328a5a81409671b5 (patch) | |
tree | 44dfbf4deb769d418968ba1505c9d1b2fa4b92f2 /app/helpers | |
parent | 1881d4f8ecbf52afd7bc732cd6c1296fafd38405 (diff) | |
download | gitlab-ce-430e7671397a1c022b88da31328a5a81409671b5.tar.gz |
Implement backoff for the circuitbreaker
The circuitbreaker now has 2 failure modes:
- Backing off: This will raise the `Gitlab::Git::Storage::Failing`
exception. Access to the shard is blocked temporarily.
- Circuit broken: This will raise the
`Gitlab::Git::Storage::CircuitBroken` exception. Access to the shard
will be blocked until the failures are reset.
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/storage_health_helper.rb | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/app/helpers/storage_health_helper.rb b/app/helpers/storage_health_helper.rb index 544c9efb845..4d2180f7eee 100644 --- a/app/helpers/storage_health_helper.rb +++ b/app/helpers/storage_health_helper.rb @@ -16,17 +16,16 @@ module StorageHealthHelper def message_for_circuit_breaker(circuit_breaker) maximum_failures = circuit_breaker.failure_count_threshold current_failures = circuit_breaker.failure_count - permanently_broken = circuit_breaker.circuit_broken? && current_failures >= maximum_failures translation_params = { number_of_failures: current_failures, maximum_failures: maximum_failures, number_of_seconds: circuit_breaker.failure_wait_time } - if permanently_broken + if circuit_breaker.circuit_broken? s_("%{number_of_failures} of %{maximum_failures} failures. GitLab will not "\ "retry automatically. Reset storage information when the problem is "\ "resolved.") % translation_params - elsif circuit_breaker.circuit_broken? + elsif circuit_breaker.backing_off? _("%{number_of_failures} of %{maximum_failures} failures. GitLab will "\ "block access for %{number_of_seconds} seconds.") % translation_params else |