Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add daemonic option #308

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions aiosqlite/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ def __init__(
connector: Callable[[], sqlite3.Connection],
iter_chunk_size: int,
loop: Optional[asyncio.AbstractEventLoop] = None,
daemonic: bool = False,
) -> None:
super().__init__()
super().__init__(daemon=daemonic)
self._running = True
self._connection: Optional[sqlite3.Connection] = None
self._connector = connector
Expand Down Expand Up @@ -371,6 +372,7 @@ def connect(
*,
iter_chunk_size=64,
loop: Optional[asyncio.AbstractEventLoop] = None,
daemonic: bool = False,
**kwargs: Any,
) -> Connection:
"""Create and return a connection proxy to the sqlite database."""
Expand All @@ -391,4 +393,4 @@ def connector() -> sqlite3.Connection:

return sqlite3.connect(loc, **kwargs)

return Connection(connector, iter_chunk_size)
return Connection(connector, iter_chunk_size, daemonic)