Skip to content

Commit 4b3b55f

Browse files
committed
Handle 429 responses from the hub API
1 parent ccff633 commit 4b3b55f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

simulate.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,11 @@ async def start_named_server(
148148
),
149149
)
150150
)
151+
elif resp.status == 429:
152+
# Sleep for upto roughly 2s and try again
153+
# FIXME: Make more robust and use a retry app?
154+
await asyncio.sleep(1 + random.random())
155+
return await start_named_server(session, server, profile_options)
151156
elif resp.status == 201:
152157
# Means the server is immediately ready, and i don't want to deal with that yet
153158
raise NotImplementedError()

0 commit comments

Comments
 (0)