You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the threads spawned by aiosqlite's Connection are non-daemon threads, so if you don't explicitly close the connection, the program will stay alive after the main thread exits.
In my use case, I want to use aiosqlite with Quart, but because I don't want to create a database connection + thread for every request, I will do all my databasing with a single, global connection. However, I'm not sure when the web server will exit and I don't want the program to hang if the database connection hasn't been explicitly closed.
Details
OS: Ubuntu 22
Python version: 3.10
aiosqlite version: 0.20.0
Can you repro on 'main' branch? yes
Can you repro in a clean virtualenv? yes
The text was updated successfully, but these errors were encountered:
smanolloff
added a commit
to smanolloff/aiosqlite
that referenced
this issue
Oct 28, 2024
Normally, the Connection thread prevents program exit unless
close() is explicitly closed, unless `deaemonic=True` is passed.
It defaults to `False` which means aiosqlite's behaviour remains unaffected.
This PR would also address issues which have been opened for some time now:
omnilib#74omnilib#299
Description
Currently, the threads spawned by aiosqlite's Connection are non-daemon threads, so if you don't explicitly close the connection, the program will stay alive after the main thread exits.
The following aiosqlite code will never exit:
But the equivalent sqlite code does exit:
In my use case, I want to use aiosqlite with Quart, but because I don't want to create a database connection + thread for every request, I will do all my databasing with a single, global connection. However, I'm not sure when the web server will exit and I don't want the program to hang if the database connection hasn't been explicitly closed.
Details
The text was updated successfully, but these errors were encountered: