diff --git a/chrome/content/zotero/xpcom/data/feeds.js b/chrome/content/zotero/xpcom/data/feeds.js index edc24927bc..f36b5060f5 100644 --- a/chrome/content/zotero/xpcom/data/feeds.js +++ b/chrome/content/zotero/xpcom/data/feeds.js @@ -258,6 +258,9 @@ Zotero.Feeds = new function () { }; let globalFeedCheckDelay = Promise.resolve(); + + this._nextFeedCheckDelay = null; // For tests + this.scheduleNextFeedCheck = async function () { // Don't schedule if already updating, since another check is scheduled at the end if (_updating) { @@ -280,6 +283,7 @@ Zotero.Feeds = new function () { if (nextCheck !== false) { nextCheck = nextCheck > 0 ? nextCheck * 1000 : 0; + this._nextFeedCheckDelay = nextCheck; Zotero.debug("Next feed check in " + (nextCheck / 1000) + " seconds"); this._nextFeedCheck = setTimeout(async () => { await globalFeedCheckDelay; diff --git a/test/tests/feedsTest.js b/test/tests/feedsTest.js index d2fd4412d3..6eddc93e9d 100644 --- a/test/tests/feedsTest.js +++ b/test/tests/feedsTest.js @@ -224,7 +224,6 @@ describe("Zotero.Feeds", function () { describe('#scheduleNextFeedCheck()', function () { it('schedules next feed check', async function () { sinon.spy(Zotero.Feeds, 'scheduleNextFeedCheck'); - sinon.spy(Zotero.Promise, 'delay'); await clearFeeds(); let feed = await createFeed({refreshInterval: 1}); @@ -234,10 +233,9 @@ describe("Zotero.Feeds", function () { await Zotero.Feeds.scheduleNextFeedCheck(); // Allow a propagation delay of 5000ms - assert.isTrue(Zotero.Promise.delay.args[0][0] - 1000*60*60 <= 5000); + assert.isTrue(Zotero.Feeds._nextFeedCheckDelay - 1000 * 60 * 60 <= 5000); Zotero.Feeds.scheduleNextFeedCheck.restore(); - Zotero.Promise.delay.restore(); }); }) })