k98kurz / sqloquent

Python 3+ SQL ORM system inspired by Eloquent
Other
1 stars 0 forks source link

Async ORM: fix ResourceWarning #16

Open k98kurz opened 2 weeks ago

k98kurz commented 2 weeks ago

The nest-asyncio dependency resolved the RuntimeErrors in the async ORM, but it introduced sporadic ResourceWarnings. A better solution is needed in the long term. Possibilities:

  1. Fork nest-asyncio, fix the issue, and publish a new package. Assumes that the problem is fixable in the nest-asyncio code.
  2. Re-engineer the async ORM to return coroutines from properties and make property setters asynchronous. Getting good type hints may be difficult.

If I think of more possibilities for fixing this, I will add them here.

k98kurz commented 2 weeks ago

Related to option 2:

https://stackoverflow.com/questions/79058037/python-3-10-call-async-function-within-a-property-in-a-way-that-does-not-produ

https://stackoverflow.com/questions/78824996/run-an-async-function-from-a-sync-function-within-an-already-running-event-loop/78826778?noredirect=1#comment139403331_78826778