Skip to content

Sqlite connection close() should wait for the database to be closed #1452

Closed
@andrewwhitehead

Description

@andrewwhitehead

The current implementation of close() for SqliteConnection is basically a no-op, relying on the drop method to close the connection. However, the connection handle is also owned by the statement worker thread, and so it will not be dropped until that thread polls the statement command queue and finds it empty. In effect, this means that there can be a noticeable delay between awaiting close() and the database connection actually being closed – this means that it is not (consistently) safe to close the database and then immediately try to remove the database file.

It looks like some refactoring would be necessary to make this work as expected, perhaps using an async channel to await the actual drop of the connection handle.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions