mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #20348 from overleaf/jpa-disable-bull-pro
[web] provide stub interface for bull queues in Server Pro/CE GitOrigin-RevId: 014cf1a87c266fd760ff3c2bd493689bbf16e637
This commit is contained in:
parent
88196f8e38
commit
e61b157666
2 changed files with 15 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
},
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue