Check for closed database and cancel sync
This can prevent a long hang if there's a shutdown during sync.
This commit is contained in:
parent
d3fc4eb554
commit
121a2f79a8
|
@ -40,6 +40,7 @@ Zotero.DBConnection = function(dbName) {
|
|||
|
||||
Components.utils.import("resource://gre/modules/Sqlite.jsm", this);
|
||||
|
||||
this.closed = false;
|
||||
this.skipBackup = false;
|
||||
this.transactionVacuum = false;
|
||||
|
||||
|
@ -913,6 +914,7 @@ Zotero.DBConnection.prototype.checkException = function (e) {
|
|||
Zotero.DBConnection.prototype.closeDatabase = Zotero.Promise.coroutine(function* (permanent) {
|
||||
if (this._connection) {
|
||||
Zotero.debug("Closing database");
|
||||
this.closed = true;
|
||||
yield this._connection.close();
|
||||
this._connection = undefined;
|
||||
this._connection = permanent ? false : null;
|
||||
|
|
|
@ -670,6 +670,9 @@ Zotero.Sync.Data.Local = {
|
|||
options.onError(e);
|
||||
}
|
||||
|
||||
if (Zotero.DB.closed) {
|
||||
e.fatal = true;
|
||||
}
|
||||
if (options.stopOnError || e.fatal) {
|
||||
throw e;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user