Skip to content

Commit

Permalink
set load requests post timeout (#107)
Browse files Browse the repository at this point in the history
* set load requests post timeout, default to 10, or set LOG10_REQUESTS_TIMEOUT

* bump version to 0.6.3
  • Loading branch information
wenzhe-log10 authored Feb 21, 2024
1 parent 48b6324 commit 08d79d2
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 103 deletions.
4 changes: 3 additions & 1 deletion log10/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ def post_request(url: str, json_payload: dict = {}) -> requests.Response:
json_payload["organization_id"] = org_id
try:
# todo: set timeout
res = requests.post(url, headers=headers, json=json_payload)
res = requests.post(
url, headers=headers, json=json_payload, timeout=os.environ.get("LOG10_REQUESTS_TIMEOUT", 10)
)
# raise_for_status() will raise an exception if the status is 4xx, 5xxx
res.raise_for_status()

Expand Down
Loading

0 comments on commit 08d79d2

Please sign in to comment.