From af3629687bc037c2c9b98e05170cf313d56d36eb Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Thu, 1 Sep 2022 10:33:08 +0100 Subject: [PATCH] Merge pull request #9335 from overleaf/bg-queue-polling combine dropbox polls and updates into one queue GitOrigin-RevId: b966f706af9000ce80977b78cd84207a22db25a2 --- .../app/src/Features/ThirdPartyDataStore/TpdsUpdateSender.js | 4 +++- .../unit/src/ThirdPartyDataStore/TpdsUpdateSenderTests.js | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/services/web/app/src/Features/ThirdPartyDataStore/TpdsUpdateSender.js b/services/web/app/src/Features/ThirdPartyDataStore/TpdsUpdateSender.js index 448e079cf4..3263dc72f9 100644 --- a/services/web/app/src/Features/ThirdPartyDataStore/TpdsUpdateSender.js +++ b/services/web/app/src/Features/ThirdPartyDataStore/TpdsUpdateSender.js @@ -253,7 +253,9 @@ async function pollDropboxForUser(userId) { }, } - return enqueue(`poll-dropbox:${userId}`, 'standardHttpRequest', job) + // Queue poll requests in the user queue along with file updates, in order + // to avoid race conditions between polling and updates. + return enqueue(userId, 'standardHttpRequest', job) } const TpdsUpdateSender = { diff --git a/services/web/test/unit/src/ThirdPartyDataStore/TpdsUpdateSenderTests.js b/services/web/test/unit/src/ThirdPartyDataStore/TpdsUpdateSenderTests.js index 37f42549e3..e9c13ccc3d 100644 --- a/services/web/test/unit/src/ThirdPartyDataStore/TpdsUpdateSenderTests.js +++ b/services/web/test/unit/src/ThirdPartyDataStore/TpdsUpdateSenderTests.js @@ -347,7 +347,7 @@ describe('TpdsUpdateSender', function () { method: method0, } = this.request.firstCall.args[0].json - group0.should.equal(`poll-dropbox:${userId}`) + group0.should.equal(userId) method0.should.equal('standardHttpRequest') job0.method.should.equal('post')