Skip to content

Commit

Permalink
Add stop condition and fix comment
Browse files Browse the repository at this point in the history
  • Loading branch information
mrunge authored and mergify[bot] committed Feb 22, 2021
1 parent 1f3b15a commit df55ac6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions gnocchi/incoming/redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,10 @@ def add_measures_batch(self, metrics_and_measures):
notified_sacks.add(sack_name)
pipe.execute()

# if ConnectionError exception occurs, try again, max 5 times.
@tenacity.retry(
wait=utils.wait_exponential,
# Never retry except when explicitly asked by raising TryAgain
stop=tenacity.stop_after_attempt(5),
retry=tenacity.retry_if_exception_type(ConnectionError))
def _build_report(self, details):
report_vars = {'measures': 0, 'metric_details': {}}
Expand Down Expand Up @@ -183,9 +184,10 @@ def process_measures_for_sack(self, sack):
pipe.ltrim(key, item_len + 1, -1)
pipe.execute()

# if ConnectionError exception occurs, try again, max 5 times.
@tenacity.retry(
wait=utils.wait_exponential,
# Never retry except when explicitly asked by raising TryAgain
stop=tenacity.stop_after_attempt(5),
retry=tenacity.retry_if_exception_type(ConnectionError))
def iter_on_sacks_to_process(self):
self._client.config_set("notify-keyspace-events", "K$")
Expand Down

0 comments on commit df55ac6

Please sign in to comment.