Skip to content
Merged
Show file tree
Hide file tree
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: 5 additions & 1 deletion ts/data/dataInit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,13 @@ function removeJob(id: number) {
}

function makeJob(fnName: string) {
if (_shuttingDown && fnName !== 'close') {
if (_shuttingDown && fnName !== 'close' && fnName !== 'removeDB') {
throw new Error(`Rejecting SQL channel job (${fnName}); application is shutting down`);
}
if (!_shuttingDown && fnName === 'close') {
window?.log?.debug(`SQL channel job close() called, marking as shutting down`);
_shuttingDown = true;
}

_jobCounter += 1;
const id = _jobCounter;
Expand Down
2 changes: 1 addition & 1 deletion ts/node/sqlInstance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export function closeDbInstance() {
}
const dbRef = globalInstance;
globalInstance = null;
// SQLLite documentation suggests that we run `PRAGMA optimize` right before
// SQlite documentation suggests that we run `PRAGMA optimize` right before
// closing the database connection.
dbRef.pragma('optimize');
dbRef.close();
Expand Down
Loading