Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved request configuration - addittional changes (#88) (#205)
Browse files Browse the repository at this point in the history
anna1492 committed Nov 13, 2023
1 parent a3bbbac commit eb40511
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions artemis/utils.py
Original file line number Diff line number Diff line change
@@ -57,14 +57,14 @@ def throttle_request(f: Callable[[], Any]) -> Any:
if func_time < average_time_per_request:
time.sleep(average_time_per_request - func_time)
elif request_per_second < 1:
seconds_for_req = math.floor(1 / request_per_second)
seconds_for_req = 1 / request_per_second
f_start = time.time()
try:
return f()
finally:
func_time = time.time() - f_start
if func_time < seconds_for_req:
time.sleep(func_time - f_start)
time.sleep(seconds_for_req - func_time)


def get_host_from_url(url: str) -> str:

0 comments on commit eb40511

Please sign in to comment.