Hi folks, I was going to write this in django developers, but looks like I might have found a small area for improvement for the async_unsafe decorator, but first let me give you a bit of background:
We're upgrading to Django 3.0 and we've been encountering this error on ci when running all the tests: "OSError: [Errno 24] Too many open files". Here's the full stack trace: https://dpaste.com/ABYJFP6CR By inspecting it and the source code it seems to be related to the async_unsafe decorator: https://github.com/django/django/blob/855fc06236630464055b4f9ea422c68a07c6d02a/django/utils/asyncio.py#L19 This decorator calls `get_event_loop`: https://github.com/python/cpython/blob/3.7/Lib/asyncio/events.py#L632 which creates a new loop every time, which seems to be the cause of the too many files open. Wouldn't be best to use `get_running_loop` https://github.com/python/cpython/blob/3.7/Lib/asyncio/events.py#L681 ? We are already checking for RuntimeError so it should be an easy fix, but I wonder if the usage of `get_event_loop` is intentional and I'm missing something here. Happy to provide a patch for this :) Patrick -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/a7cedcc5-b041-4f21-9a22-e9ffb92d3c91n%40googlegroups.com.
