diff --git a/services/web/app/src/infrastructure/Queues.js b/services/web/app/src/infrastructure/Queues.js index 6610528097..0a03bdf24c 100644 --- a/services/web/app/src/infrastructure/Queues.js +++ b/services/web/app/src/infrastructure/Queues.js @@ -1,5 +1,6 @@ const Queue = require('bull') const Settings = require('@overleaf/settings') +const Features = require('../infrastructure/Features') const { addConnectionDrainer } = require('./GracefulShutdown') // Bull will keep a fixed number of the most recently completed jobs. This is @@ -62,6 +63,14 @@ const ANALYTICS_QUEUES = [ const queues = {} function getQueue(queueName) { + if (!Features.hasFeature('saas')) { + // Disable bull queue handling for Server Pro/CE by providing a stub interface. + return { + async add() {}, + process() {}, + } + } + if (!queues[queueName]) { const redisOptions = ANALYTICS_QUEUES.includes(queueName) ? Settings.redis.analyticsQueues diff --git a/services/web/test/unit/src/Subscription/FeaturesUpdaterTests.js b/services/web/test/unit/src/Subscription/FeaturesUpdaterTests.js index 2f891f9cca..d517099605 100644 --- a/services/web/test/unit/src/Subscription/FeaturesUpdaterTests.js +++ b/services/web/test/unit/src/Subscription/FeaturesUpdaterTests.js @@ -98,6 +98,11 @@ describe('FeaturesUpdater', function () { this.Modules = { promises: { hooks: { fire: sinon.stub().resolves() } }, } + this.Queues = { + getQueue: sinon.stub().returns({ + add: sinon.stub().resolves(), + }), + } this.FeaturesUpdater = SandboxedModule.require(MODULE_PATH, { requires: { @@ -110,6 +115,7 @@ describe('FeaturesUpdater', function () { '../User/UserGetter': this.UserGetter, '../Analytics/AnalyticsManager': this.AnalyticsManager, '../../infrastructure/Modules': this.Modules, + '../../infrastructure/Queues': this.Queues, }, }) })