Skip to content

Commit

Permalink
Issue segmentio#478: Modify time sent from server to be seconds vs ti…
Browse files Browse the repository at this point in the history
…mestamp
  • Loading branch information
nd4p90x committed Aug 19, 2024
1 parent 7583887 commit cde5153
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions segment/analytics/oauth_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,13 @@ def _poller_loop(self):

elif response.status_code == 429:
self.retry_count += 1
rate_limit_reset_timestamp = None
rate_limit_reset_time = None
try:
rate_limit_reset_timestamp = int(response.headers.get("X-RateLimit-Reset"))
rate_limit_reset_time = int(response.headers.get("X-RateLimit-Reset"))
except Exception as e:
self.log.error("OAuth rate limit response did not have a valid rest time: {} | {}".format(response, e))
if rate_limit_reset_timestamp:
refresh_timer_ms = rate_limit_reset_timestamp - time.time() * 1000
if rate_limit_reset_time:
refresh_timer_ms = rate_limit_reset_time * 1000
else:
refresh_timer_ms = 5 * 1000

Expand Down

0 comments on commit cde5153

Please sign in to comment.