Skip to content

Commit 02252d8

Browse files
dsotirho-ucschannes-ucsc
authored andcommitted
Add a default value for the /repository/files wait parameter
1 parent cf27d1f commit 02252d8

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

lambdas/service/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1661,7 +1661,7 @@ def generate_manifest(event: AnyJSON, _context: LambdaContext):
16611661
),
16621662
params.query(
16631663
'wait',
1664-
schema.optional(int),
1664+
schema.optional(schema.with_default(0)),
16651665
description=fd('''
16661666
If 0, the client is responsible for honoring the waiting period
16671667
specified in the Retry-After response header. If 1, the server

lambdas/service/openapi.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11169,7 +11169,8 @@
1116911169
"required": false,
1117011170
"schema": {
1117111171
"type": "integer",
11172-
"format": "int64"
11172+
"format": "int64",
11173+
"default": 0
1117311174
},
1117411175
"description": "\nIf 0, the client is responsible for honoring the waiting period\nspecified in the Retry-After response header. If 1, the server\nwill delay the response in order to consume as much of that\nwaiting period as possible. This parameter should only be set to\n1 by clients who can't honor the `Retry-After` header,\npreventing them from quickly exhausting the maximum number of\nredirects. If the server cannot wait the full amount, any amount\nof wait time left will still be returned in the Retry-After\nheader of the response.\n"
1117511176
},
@@ -11304,7 +11305,8 @@
1130411305
"required": false,
1130511306
"schema": {
1130611307
"type": "integer",
11307-
"format": "int64"
11308+
"format": "int64",
11309+
"default": 0
1130811310
},
1130911311
"description": "\nIf 0, the client is responsible for honoring the waiting period\nspecified in the Retry-After response header. If 1, the server\nwill delay the response in order to consume as much of that\nwaiting period as possible. This parameter should only be set to\n1 by clients who can't honor the `Retry-After` header,\npreventing them from quickly exhausting the maximum number of\nredirects. If the server cannot wait the full amount, any amount\nof wait time left will still be returned in the Retry-After\nheader of the response.\n"
1131011312
},

src/azul/service/repository_controller.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
)
55
import json
66
import logging
7+
from math import (
8+
ceil,
9+
)
710
from typing import (
811
Optional,
912
TYPE_CHECKING,
@@ -263,7 +266,7 @@ def download_file(self,
263266
pass
264267
elif wait == '1':
265268
time_slept = self.server_side_sleep(float(retry_after))
266-
retry_after = round(retry_after - time_slept)
269+
retry_after = ceil(retry_after - time_slept)
267270
else:
268271
assert False, wait
269272
query_params['wait'] = wait

0 commit comments

Comments
 (0)