Skip to content

Commit

Permalink
Decrease timeout and retry count
Browse files Browse the repository at this point in the history
  • Loading branch information
jonakoudijs committed Jul 27, 2024
1 parent 1a2951d commit f3f04bd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,16 @@


def app_info(app_id):
connect_retries = 3
connect_timeout = 5
connect_retries = 2
connect_timeout = 3
current_time = str(datetime.datetime.now())

logging.info("Started requesting app info", extra={"app_id": app_id})

try:
# Sometimes it hangs for 30+ seconds. Normal connection takes about 500ms
for _ in range(connect_retries):
count = _ + 1
count = str(count)
count = str(_)

try:
with gevent.Timeout(connect_timeout):
Expand Down
8 changes: 8 additions & 0 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@ def read_app(app_id: int, pretty: bool = False):
else:
info = app_info(app_id)

if info == None:
logging.info(
"The SteamCMD backend returned no actual data and failed",
extra={"app_id": app_id},
)
# return empty result for not found app
return {"data": {app_id: {}}, "status": "failed", "pretty": pretty}

if not info["apps"]:
logging.info(
"No app has been found at Steam but the request was succesfull",
Expand Down

0 comments on commit f3f04bd

Please sign in to comment.