Skip to content

Commit

Permalink
Account for manual limits being str
Browse files Browse the repository at this point in the history
  • Loading branch information
rgaudin committed Sep 8, 2023
1 parent a7177ea commit 7934fc9
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions api/src/routes/requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,16 @@ def post(self, *args, **kwargs):
del document["flags"][flag]

# make sure we cap requests to ZIMIT_LIMIT at most
document["flags"]["sizeLimit"] = str(
min(
[document["flags"].get("sizeLimit", ZIMIT_SIZE_LIMIT), ZIMIT_SIZE_LIMIT]
)
)
document["flags"]["timeLimit"] = str(
min(
[document["flags"].get("timeLimit", ZIMIT_TIME_LIMIT), ZIMIT_TIME_LIMIT]
)
)
try:
size_limit = int(document["flags"].get("sizeLimit", ZIMIT_SIZE_LIMIT))
except Exception:
size_limit = ZIMIT_SIZE_LIMIT
document["flags"]["sizeLimit"] = str(min([size_limit, ZIMIT_SIZE_LIMIT]))
try:
time_limit = int(document["flags"].get("timeLimit", ZIMIT_TIME_LIMIT))
except Exception:
time_limit = ZIMIT_TIME_LIMIT
document["flags"]["timeLimit"] = min([time_limit, ZIMIT_TIME_LIMIT])

config = {
"task_name": "zimit",
Expand Down

0 comments on commit 7934fc9

Please sign in to comment.