L. Kärkkäinen
L. Kärkkäinen
You can do it without `__anext__` or any other extra boilerplate by simply adding this function to the websocket class: ```python async def __aiter__(self): while True: yield await self.recv() ```...
> My question is, should we make the whole `ws` (`WebsocketImplProtocol`) object async iterable? Or just make another `recv`-like method to return an async generator? The whole purpose of `__aiter__`...
Because this is Sanic, I ran a benchmark. The built-in async iterator is some nanoseconds faster per call but while barely measurable, the difference is utterly negligible to anything else...
Code clarity should probably take precedence since there really is no speed difference either way :)
Static *routes* are indeed checked first but since static files are served as a dynamic route, any other dynamic routes in the application may conflict with them. Making static files...
This affects serving from a subdirectory too: ```python @app.static("/.well-known/", "/tmp/well-known/") @app.get("/") def handler(request, path): return response.redirect(f"https://{request.server_name}/{path}") ``` Expected anything that begins with `/.well-known/` to be served as a static file,...
Actually the above was caused by the trailing slashes on `app.static`. It turns out that ```python # Works as intended app.static("/.well-known", "/tmp/well-known", resource_type="dir") # No error on server startup, just...
```python app.add_task(app.ctx.dns_synchronizer.start_sync()) ``` I think you need to remove the `()`.
You are correct, it should work either way and makes no difference. Sanic just seems to forward that to asyncio's `create_task` but it will call it first if needed. A...
Hmm yes, it *does* work just fine prior to `app.run`, my mistake, and when used on module level it runs on every worker but **not** on the main process. You...