mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #3607 from overleaf/em-bull-completed
Keep a fixed number of completed jobs in Bull GitOrigin-RevId: c4a1cdf9ce811be7624b46c876fca0ac1d4253c6
This commit is contained in:
parent
37d45d64b3
commit
979a2b0be5
1 changed files with 6 additions and 1 deletions
|
@ -3,6 +3,11 @@ const Settings = require('settings-sharelatex')
|
||||||
|
|
||||||
const analyticsQueues = {}
|
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() {
|
function initialize() {
|
||||||
if (Settings.analytics.enabled) {
|
if (Settings.analytics.enabled) {
|
||||||
analyticsQueues.events = createQueue('analytics-events')
|
analyticsQueues.events = createQueue('analytics-events')
|
||||||
|
@ -14,7 +19,7 @@ function createQueue(queueName, defaultJobOptions) {
|
||||||
return new Queue(queueName, {
|
return new Queue(queueName, {
|
||||||
redis: Settings.redis.queues,
|
redis: Settings.redis.queues,
|
||||||
defaultJobOptions: {
|
defaultJobOptions: {
|
||||||
removeOnComplete: true,
|
removeOnComplete: MAX_COMPLETED_JOBS_RETAINED,
|
||||||
attempts: 11,
|
attempts: 11,
|
||||||
backoff: {
|
backoff: {
|
||||||
type: 'exponential',
|
type: 'exponential',
|
||||||
|
|
Loading…
Reference in a new issue