Ensure db is closed properly when exiting
This commit is contained in:
parent
9763c11f3f
commit
74a80f6ec4
1 changed files with 7 additions and 2 deletions
|
|
@ -24,8 +24,13 @@ impl Vault {
|
|||
fn run(conn: Connection, mut rx: mpsc::Receiver<Request>) -> anyhow::Result<()> {
|
||||
while let Some(request) = rx.blocking_recv() {
|
||||
match request {
|
||||
// Drops the Sender resulting in `Vault::close` exiting
|
||||
Request::Close(_) => break,
|
||||
Request::Close(tx) => {
|
||||
// Ensure `Vault::close` exits only after the sqlite connection
|
||||
// has been closed properly.
|
||||
drop(conn);
|
||||
drop(tx);
|
||||
break;
|
||||
}
|
||||
Request::Nop => {}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue