QUERY · ISSUE
extmod/uasyncio: add serve_forever()?
extmod
Official example from python documentation:
async def main():
# Get a reference to the event loop as we plan to use
# low-level APIs.
loop = asyncio.get_running_loop()
server = await loop.create_server(
lambda: EchoServerProtocol(),
'127.0.0.1', 8888)
async with server:
await server.serve_forever()
asyncio.run(main())
Micropython's Server class already has support for async with, but lacks convenient method serve_forever.
Do you think it is make sense to add it?
CANDIDATE · ISSUE
`Loop.run_forever()` doesn't run forever (?)
extmod
- firmware: esp32-idf4-20200906-unstable-v1.13-4-g3ff707927.bin
testing code:
from uasyncio import get_event_loop
loop = get_event_loop()
try:
print("run_forever")
loop.run_forever()
finally:
loop.stop()
loop.close()
On CPython, it will run forever, but not on MicroPython for me.
Isn't its implementation equivalent to the CPython implementation?