From 13729495235260c4cb17d93071c8825d157fa003 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Mon, 19 Jun 2017 00:49:34 -0400 Subject: [PATCH] Don't initialize DB backup idle observer until after schema init --- chrome/content/zotero/xpcom/db.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/chrome/content/zotero/xpcom/db.js b/chrome/content/zotero/xpcom/db.js index 5938e8dfad..305ac23dcf 100644 --- a/chrome/content/zotero/xpcom/db.js +++ b/chrome/content/zotero/xpcom/db.js @@ -1302,11 +1302,13 @@ Zotero.DBConnection.prototype._getConnectionAsync = Zotero.Promise.coroutine(fun // Enable foreign key checks yield this.queryAsync("PRAGMA foreign_keys=true"); - // Register idle and shutdown handlers to call this.observe() for DB backup - var idleService = Components.classes["@mozilla.org/widget/idleservice;1"] + // Register idle observer for DB backup + Zotero.Schema.schemaUpdatePromise.then(() => { + Zotero.debug("Initializing DB backup idle observer"); + var idleService = Components.classes["@mozilla.org/widget/idleservice;1"] .getService(Components.interfaces.nsIIdleService); - idleService.addIdleObserver(this, 60); - idleService = null; + idleService.addIdleObserver(this, 300); + }); return this._connection; });