Skip to content

Commit

Permalink
Add logs to pushbullet alerting code
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelhball committed Apr 3, 2024
1 parent 8c14a28 commit faf6108
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions discogs_alert/alert/pushbullet.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def get_all_alerts(self) -> AlertDict:
resp = requests.get(url, headers=headers)
rate_limit_remaining = int(resp.headers.get("X-Ratelimit-Remaining"))
while rate_limit_remaining < 2:
logger.info("About to hit pushbullet's rate limit, waiting 60s")
time.sleep(60)
resp = requests.get(url, headers=headers)
rate_limit_remaining = int(resp.headers.get("X-Ratelimit-Remaining"))
Expand All @@ -29,6 +30,7 @@ def get_all_alerts(self) -> AlertDict:
cursor = None
while cursor is not None:
if rate_limit_remaining < 2:
logger.info("About to hit pushbullet's rate limit, waiting 60s")
time.sleep(60)
resp = requests.get(url + f"&cursor={cursor}", headers=headers)
rate_limit_remaining = int(resp.headers.get("X-Ratelimit-Remaining"))
Expand Down

0 comments on commit faf6108

Please sign in to comment.