Skip to content
This repository has been archived by the owner on Jan 7, 2019. It is now read-only.

Commit

Permalink
Replace retrying with tenacity
Browse files Browse the repository at this point in the history
As per rholder/retrying#79 retrying is dead. Tenaciy is a community maintained fork.
This also fixes a problem with retry swallowing exceptions.
  • Loading branch information
benvand committed Sep 21, 2018
1 parent 65bad61 commit 9fcec3a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
import logging
import os

from datetime import datetime, timedelta
import boto3
import requests
import yaml
from retrying import retry
from datetime import datetime, timedelta
from tenacity import retry, wait_fixed, retry_if_result


logger = logging.getLogger("app")
Expand Down Expand Up @@ -104,7 +104,7 @@ def get_metrics_from_cloudwatch_and_format_for_hostedgraphite(config):
base_metrics = create_hostedgraphite_base_metrics(config)
send_to_hostedgraphite("\n".join(base_metrics))

@retry(wait_fixed=60000, retry_on_result=lambda res: res is None)
@retry(wait=wait_fixed(60), retry=retry_if_result(lambda res: res is None))
def sleep_and_send_retry():
"""Wrapper to apply retry to get and send methods."""
hostedgraphite_metrics = get_metrics_from_cloudwatch_and_format_for_hostedgraphite(config)
Expand Down
2 changes: 1 addition & 1 deletion requirements-app.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
retrying==1.3.3
tenacity==5.0.2
requests==2.17.3
PyYAML==3.13
boto3==1.9.6
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This file is autogenerated. Do not edit it manually.
retrying==1.3.3
tenacity==5.0.2
requests==2.17.3
PyYAML==3.13
boto3==1.9.6
Expand Down

0 comments on commit 9fcec3a

Please sign in to comment.