www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 9a45fa94bd2863a54f1da37c928736da2731db15
parent 2d6143dce1790da2134aa2e5bd19a50157453738
Author: Dan Stillman <dstillman@zotero.org>
Date:   Mon,  8 Jun 2015 03:59:16 -0400

Move transaction wait debug output to level 6, and strip Bluebird lines

This output is basically only useful when something hangs, so it can
stay off all other times.

For now, 6 can be the new only-use-when-something-is-actively-broken
level. At some point we may want to move DB activity to 4 and make this
sort of thing 5, because we don't have much that's 4 right now.

Diffstat:
Mchrome/content/zotero/xpcom/db.js | 6++++--
Mchrome/content/zotero/xpcom/debug.js | 10++++++++++
2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/chrome/content/zotero/xpcom/db.js b/chrome/content/zotero/xpcom/db.js @@ -584,8 +584,10 @@ Zotero.DBConnection.prototype.waitForTransaction = function () { if (!this._inTransaction) { return Zotero.Promise.resolve().cancellable(); } - Zotero.debug("Waiting for transaction to finish"); - Zotero.debug((new Error).stack); + if (Zotero.Debug.enabled) { + Zotero.debug("Waiting for transaction to finish", 5); + Zotero.debug(Zotero.Debug.filterStack((new Error).stack), 6); + } return this._transactionPromise; }; diff --git a/chrome/content/zotero/xpcom/debug.js b/chrome/content/zotero/xpcom/debug.js @@ -204,4 +204,14 @@ Zotero.Debug = new function () { } return str.substr(1); }; + + + /** + * Strip Bluebird lines from a stack trace + * + * @param {String} stack + */ + this.filterStack = function (stack) { + return stack.split(/\n/).filter(line => line.indexOf('zotero/bluebird') == -1).join('\n'); + } }