Cancel pending feed update check on Zotero shutdown
This avoids errors for a missing 'feeds' table during tests, when the callback started in Zotero.Feeds.init() runs but the Zotero object has been torn down and the database hasn't yet been reinitialized.
This commit is contained in:
parent
6907af86fd
commit
dd9cc40c16
2 changed files with 13 additions and 2 deletions
|
@ -26,8 +26,18 @@
|
|||
// Mimics Zotero.Libraries
|
||||
Zotero.Feeds = new function() {
|
||||
this.init = function () {
|
||||
setTimeout(() => this.scheduleNextFeedCheck(), 5000);
|
||||
}
|
||||
this._timeoutID = setTimeout(() => {
|
||||
this.scheduleNextFeedCheck();
|
||||
this._timeoutID = null;
|
||||
}, 5000);
|
||||
};
|
||||
|
||||
this.uninit = function () {
|
||||
if (this._timeoutID) {
|
||||
clearTimeout(this._timeoutID);
|
||||
this._timeoutID = null
|
||||
}
|
||||
};
|
||||
|
||||
this._cache = null;
|
||||
|
||||
|
|
|
@ -736,6 +736,7 @@ Components.utils.import("resource://gre/modules/osfile.jsm");
|
|||
|
||||
Zotero.Items.startEmptyTrashTimer();
|
||||
Zotero.Feeds.init();
|
||||
Zotero.addShutdownListener(() => Zotero.Feeds.uninit());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue