diff --git a/services/web/app/src/infrastructure/Queues.js b/services/web/app/src/infrastructure/Queues.js index ed3be3a52e..e4cc7f8c72 100644 --- a/services/web/app/src/infrastructure/Queues.js +++ b/services/web/app/src/infrastructure/Queues.js @@ -3,6 +3,11 @@ const Settings = require('settings-sharelatex') const analyticsQueues = {} +// Bull will keep a fixed number of the most recently completed jobs. This is +// useful to inspect recently completed jobs. The bull prometheus exporter also +// uses the completed job records to report on job duration. +const MAX_COMPLETED_JOBS_RETAINED = 10000 + function initialize() { if (Settings.analytics.enabled) { analyticsQueues.events = createQueue('analytics-events') @@ -14,7 +19,7 @@ function createQueue(queueName, defaultJobOptions) { return new Queue(queueName, { redis: Settings.redis.queues, defaultJobOptions: { - removeOnComplete: true, + removeOnComplete: MAX_COMPLETED_JOBS_RETAINED, attempts: 11, backoff: { type: 'exponential',