We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5ca115a commit b710e0bCopy full SHA for b710e0b
src/py/extra/server.py
@@ -307,13 +307,21 @@ async def Serve(
307
if options.condition and not options.condition():
308
break
309
try:
310
- client, _ = await loop.sock_accept(server)
+ client, _ = (
311
+ await asyncio.wait_for(
312
+ loop.sock_accept(server), timeout=options.timeout
313
+ )
314
+ if options.timeout
315
+ else loop.sock_accept(server)
316
317
# NOTE: Should do something with the tasks
318
task = loop.create_task(
319
cls.OnRequest(app, client, loop=loop, options=options)
320
)
321
tasks.add(task)
322
task.add_done_callback(tasks.discard)
323
+ except asyncio.TimeoutError:
324
+ continue
325
except OSError as e:
326
# This can be: [OSError] [Errno 24] Too many open files
327
if e.errno == 24:
0 commit comments