Skip to content

Commit

Permalink
replaced process_time() with monotonic(), which measures elapsed time
Browse files Browse the repository at this point in the history
  • Loading branch information
reece committed Dec 17, 2019
1 parent caeff2b commit d4508f8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions eutils/_internal/queryservice.py
Expand Up @@ -291,13 +291,13 @@ def _cacheable(r):

if not skip_sleep:
req_int = self.request_interval
sleep_time = req_int - (time.process_time() - self._last_request_clock)
sleep_time = req_int - (time.monotonic() - self._last_request_clock)
if sleep_time > 0:
_logger.debug('sleeping {sleep_time:.3f}'.format(sleep_time=sleep_time))
time.sleep(sleep_time)

r = requests.post(url, full_args)
self._last_request_clock = time.process_time()
self._last_request_clock = time.monotonic()
_logger.debug('post({url}, {fas}): {r.status_code} {r.reason}, {len})'.format(
url=url,
fas=full_args_str,
Expand Down

0 comments on commit d4508f8

Please sign in to comment.