Update bullmq dependency
This commit is contained in:
parent
a1c96a63a0
commit
44e12dc809
5 changed files with 25 additions and 13 deletions
|
@ -115,7 +115,7 @@
|
|||
"bencode": "^4.0.0",
|
||||
"bittorrent-tracker": "^10.0.12",
|
||||
"bluebird": "^3.5.0",
|
||||
"bullmq": "^3.6.6",
|
||||
"bullmq": "^4.12.3",
|
||||
"bytes": "^3.0.0",
|
||||
"chokidar": "^3.4.2",
|
||||
"commander": "^11.0.0",
|
||||
|
|
|
@ -3,7 +3,7 @@ import { VideoStateType } from '../videos/index.js'
|
|||
import { VideoStudioTaskCut } from '../videos/studio/index.js'
|
||||
import { SendEmailOptions } from './emailer.model.js'
|
||||
|
||||
export type JobState = 'active' | 'completed' | 'failed' | 'waiting' | 'delayed' | 'paused' | 'waiting-children'
|
||||
export type JobState = 'active' | 'completed' | 'failed' | 'waiting' | 'delayed' | 'paused' | 'waiting-children' | 'prioritized'
|
||||
|
||||
export type JobType =
|
||||
| 'activitypub-cleaner'
|
||||
|
|
|
@ -2,10 +2,10 @@ import { JobState } from '@peertube/peertube-models'
|
|||
import { jobTypes } from '@server/lib/job-queue/job-queue.js'
|
||||
import { exists } from './misc.js'
|
||||
|
||||
const jobStates: JobState[] = [ 'active', 'completed', 'failed', 'waiting', 'delayed', 'paused', 'waiting-children' ]
|
||||
const jobStates = new Set<JobState>([ 'active', 'completed', 'failed', 'waiting', 'delayed', 'paused', 'waiting-children', 'prioritized' ])
|
||||
|
||||
function isValidJobState (value: JobState) {
|
||||
return exists(value) && jobStates.includes(value)
|
||||
return exists(value) && jobStates.has(value)
|
||||
}
|
||||
|
||||
function isValidJobType (value: any) {
|
||||
|
|
|
@ -257,6 +257,9 @@ class JobQueue {
|
|||
queue.on('error', err => { logger.error('Error in job queue %s.', handlerName, { err }) })
|
||||
|
||||
this.queues[handlerName] = queue
|
||||
|
||||
queue.removeDeprecatedPriorityKey()
|
||||
.catch(err => logger.error('Cannot remove bullmq deprecated priority keys of ' + handlerName, { err }))
|
||||
}
|
||||
|
||||
private buildQueueEvent (handlerName: JobType) {
|
||||
|
@ -455,12 +458,15 @@ class JobQueue {
|
|||
}
|
||||
|
||||
private buildStateFilter (state?: JobState) {
|
||||
if (!state) return jobStates
|
||||
if (!state) return Array.from(jobStates)
|
||||
|
||||
const states = [ state ]
|
||||
|
||||
// Include parent if filtering on waiting
|
||||
if (state === 'waiting') states.push('waiting-children')
|
||||
// Include parent and prioritized if filtering on waiting
|
||||
if (state === 'waiting') {
|
||||
states.push('waiting-children')
|
||||
states.push('prioritized')
|
||||
}
|
||||
|
||||
return states
|
||||
}
|
||||
|
|
18
yarn.lock
18
yarn.lock
|
@ -3572,17 +3572,18 @@ builtins@^5.0.1:
|
|||
dependencies:
|
||||
semver "^7.0.0"
|
||||
|
||||
bullmq@^3.6.6:
|
||||
version "3.15.8"
|
||||
resolved "https://registry.yarnpkg.com/bullmq/-/bullmq-3.15.8.tgz#e8ec5b46b0b7d7ce57e509280d03745109411e05"
|
||||
integrity sha512-k3uimHGhl5svqD7SEak+iI6c5DxeLOaOXzCufI9Ic0ST3nJr69v71TGR4cXCTXdgCff3tLec5HgoBnfyWjgn5A==
|
||||
bullmq@^4.12.3:
|
||||
version "4.12.3"
|
||||
resolved "https://registry.yarnpkg.com/bullmq/-/bullmq-4.12.3.tgz#0c649b9a5e48227519c526ee9edd96b982eee22d"
|
||||
integrity sha512-4uPp4NQTALFF+eFK7g8VJM+rt0aiduQdzBomgiEO1OK4OE+TdgC6cjGXooKI/asuB8iDhSZ+pSnGYy5Xyr6qRA==
|
||||
dependencies:
|
||||
cron-parser "^4.6.0"
|
||||
glob "^8.0.3"
|
||||
ioredis "^5.3.2"
|
||||
lodash "^4.17.21"
|
||||
msgpackr "^1.6.2"
|
||||
semver "^7.3.7"
|
||||
node-abort-controller "^3.1.1"
|
||||
semver "^7.5.4"
|
||||
tslib "^2.0.0"
|
||||
uuid "^9.0.0"
|
||||
|
||||
|
@ -7458,6 +7459,11 @@ nice-try@^1.0.4:
|
|||
resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366"
|
||||
integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==
|
||||
|
||||
node-abort-controller@^3.1.1:
|
||||
version "3.1.1"
|
||||
resolved "https://registry.yarnpkg.com/node-abort-controller/-/node-abort-controller-3.1.1.tgz#a94377e964a9a37ac3976d848cb5c765833b8548"
|
||||
integrity sha512-AGK2yQKIjRuqnc6VkX2Xj5d+QW8xZ87pa1UK6yA6ouUyuxfHuMP6umE5QK7UmTeOAymo+Zx1Fxiuw9rVx8taHQ==
|
||||
|
||||
node-addon-api@^3.0.0:
|
||||
version "3.2.1"
|
||||
resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-3.2.1.tgz#81325e0a2117789c0128dab65e7e38f07ceba161"
|
||||
|
@ -8911,7 +8917,7 @@ semver@^6.0.0, semver@^6.1.0, semver@^6.3.1:
|
|||
resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4"
|
||||
integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==
|
||||
|
||||
semver@^7.0.0, semver@^7.3.2, semver@^7.3.5, semver@^7.3.7, semver@^7.3.8, semver@^7.5.1, semver@^7.5.2, semver@^7.5.3, semver@^7.5.4:
|
||||
semver@^7.0.0, semver@^7.3.2, semver@^7.3.5, semver@^7.3.8, semver@^7.5.1, semver@^7.5.2, semver@^7.5.3, semver@^7.5.4:
|
||||
version "7.5.4"
|
||||
resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e"
|
||||
integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==
|
||||
|
|
Loading…
Reference in a new issue