fix(deps): update dependency bullmq to v6 (#31914)
Co-authored-by: Daniel Dietzler <mail@ddietzler.dev>
This commit is contained in:
committed by
Codex
co-authored by
Daniel Dietzler
parent
c3f050d7c9
commit
743e555a1b
+2
-2
@@ -657,13 +657,13 @@ export const utils = {
|
||||
isQueueEmpty: async (accessToken: string, queue: keyof QueuesResponseLegacyDto) => {
|
||||
const queues = await getQueuesLegacy({ headers: asBearerAuth(accessToken) });
|
||||
const jobCounts = queues[queue].jobCounts;
|
||||
return !jobCounts.active && !jobCounts.waiting;
|
||||
return !jobCounts.active && (!jobCounts.waiting || queues[queue].queueStatus.isPaused);
|
||||
},
|
||||
|
||||
waitForQueueFinish: (accessToken: string, queue: keyof QueuesResponseLegacyDto, ms?: number) => {
|
||||
// eslint-disable-next-line no-async-promise-executor
|
||||
return new Promise<void>(async (resolve, reject) => {
|
||||
const timeout = setTimeout(() => reject(new Error('Timed out waiting for queue to empty')), ms || 10_000);
|
||||
const timeout = setTimeout(() => reject(new Error('Timed out waiting for queue to empty')), ms || 15_000);
|
||||
|
||||
while (true) {
|
||||
const done = await utils.isQueueEmpty(accessToken, queue);
|
||||
|
||||
@@ -26183,8 +26183,7 @@
|
||||
"failed",
|
||||
"completed",
|
||||
"delayed",
|
||||
"waiting",
|
||||
"paused"
|
||||
"waiting"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
@@ -26278,7 +26277,23 @@
|
||||
"description": "Number of paused jobs",
|
||||
"maximum": 9007199254740991,
|
||||
"minimum": -9007199254740991,
|
||||
"type": "integer"
|
||||
"type": "integer",
|
||||
"x-immich-history": [
|
||||
{
|
||||
"version": "v2.0.0",
|
||||
"state": "Added"
|
||||
},
|
||||
{
|
||||
"version": "v4.0.0",
|
||||
"state": "Updated",
|
||||
"description": "A paused queue will now also shows its job as `waiting`"
|
||||
},
|
||||
{
|
||||
"version": "v4.0.0",
|
||||
"state": "Deprecated"
|
||||
}
|
||||
],
|
||||
"x-immich-state": "Deprecated"
|
||||
},
|
||||
"waiting": {
|
||||
"description": "Number of waiting jobs",
|
||||
|
||||
@@ -8436,8 +8436,7 @@ export enum QueueJobStatus {
|
||||
Failed = "failed",
|
||||
Completed = "completed",
|
||||
Delayed = "delayed",
|
||||
Waiting = "waiting",
|
||||
Paused = "paused"
|
||||
Waiting = "waiting"
|
||||
}
|
||||
export enum JobName {
|
||||
AssetDelete = "AssetDelete",
|
||||
|
||||
+1
-1
@@ -66,7 +66,7 @@
|
||||
"async-lock": "^1.4.0",
|
||||
"bcrypt": "^6.0.0",
|
||||
"body-parser": "^2.2.0",
|
||||
"bullmq": "^5.51.0",
|
||||
"bullmq": "^6.0.0",
|
||||
"chokidar": "^4.0.3",
|
||||
"compression": "^1.8.0",
|
||||
"cookie": "^1.0.2",
|
||||
|
||||
@@ -54,7 +54,16 @@ export const QueueStatisticsSchema = z
|
||||
failed: z.int().describe('Number of failed jobs'),
|
||||
delayed: z.int().describe('Number of delayed jobs'),
|
||||
waiting: z.int().describe('Number of waiting jobs'),
|
||||
paused: z.int().describe('Number of paused jobs'),
|
||||
paused: z
|
||||
.int()
|
||||
.describe('Number of paused jobs')
|
||||
.meta(
|
||||
new HistoryBuilder()
|
||||
.added('v2.0.0')
|
||||
.updated('v4.0.0', 'A paused queue will now also shows its job as `waiting`')
|
||||
.deprecated('v4.0.0')
|
||||
.getExtensions(),
|
||||
),
|
||||
})
|
||||
.meta({ id: 'QueueStatisticsDto' });
|
||||
|
||||
|
||||
@@ -869,7 +869,6 @@ export enum QueueJobStatus {
|
||||
Complete = 'completed',
|
||||
Delayed = 'delayed',
|
||||
Waiting = 'waiting',
|
||||
Paused = 'paused',
|
||||
}
|
||||
|
||||
export const QueueJobStatusSchema = z.enum(QueueJobStatus).describe('Queue job status').meta({ id: 'QueueJobStatus' });
|
||||
|
||||
@@ -187,7 +187,6 @@ export class JobRepository {
|
||||
'failed',
|
||||
'delayed',
|
||||
'waiting',
|
||||
'paused',
|
||||
) as unknown as Promise<JobCounts>;
|
||||
}
|
||||
|
||||
|
||||
@@ -898,7 +898,6 @@ describe(PersonService.name, () => {
|
||||
mocks.job.getJobCounts.mockResolvedValue({
|
||||
active: 1,
|
||||
waiting: 0,
|
||||
paused: 0,
|
||||
completed: 0,
|
||||
failed: 0,
|
||||
delayed: 0,
|
||||
@@ -915,7 +914,6 @@ describe(PersonService.name, () => {
|
||||
mocks.job.getJobCounts.mockResolvedValue({
|
||||
active: 1,
|
||||
waiting: 1,
|
||||
paused: 0,
|
||||
completed: 0,
|
||||
failed: 0,
|
||||
delayed: 0,
|
||||
@@ -931,7 +929,6 @@ describe(PersonService.name, () => {
|
||||
mocks.job.getJobCounts.mockResolvedValue({
|
||||
active: 1,
|
||||
waiting: 0,
|
||||
paused: 0,
|
||||
completed: 0,
|
||||
failed: 0,
|
||||
delayed: 0,
|
||||
@@ -962,7 +959,6 @@ describe(PersonService.name, () => {
|
||||
mocks.job.getJobCounts.mockResolvedValue({
|
||||
active: 1,
|
||||
waiting: 0,
|
||||
paused: 0,
|
||||
completed: 0,
|
||||
failed: 0,
|
||||
delayed: 0,
|
||||
@@ -994,7 +990,6 @@ describe(PersonService.name, () => {
|
||||
mocks.job.getJobCounts.mockResolvedValue({
|
||||
active: 1,
|
||||
waiting: 0,
|
||||
paused: 0,
|
||||
completed: 0,
|
||||
failed: 0,
|
||||
delayed: 0,
|
||||
@@ -1049,7 +1044,6 @@ describe(PersonService.name, () => {
|
||||
mocks.job.getJobCounts.mockResolvedValue({
|
||||
active: 1,
|
||||
waiting: 0,
|
||||
paused: 0,
|
||||
completed: 0,
|
||||
failed: 0,
|
||||
delayed: 0,
|
||||
|
||||
@@ -185,7 +185,7 @@ export class QueueService extends BaseService {
|
||||
this.jobRepository.getJobCounts(name),
|
||||
this.jobRepository.isPaused(name),
|
||||
]);
|
||||
return { name, isPaused, statistics };
|
||||
return { name, isPaused, statistics: { ...statistics, paused: 0 } };
|
||||
}
|
||||
|
||||
private async start(name: QueueName, { force }: QueueCommandDto): Promise<void> {
|
||||
|
||||
@@ -343,7 +343,6 @@ export interface JobCounts {
|
||||
failed: number;
|
||||
delayed: number;
|
||||
waiting: number;
|
||||
paused: number;
|
||||
}
|
||||
|
||||
export type JobItem =
|
||||
|
||||
@@ -518,7 +518,7 @@ describe(PersonService.name, () => {
|
||||
const jobRepo = ctx.getMock(JobRepository);
|
||||
ctx.getMock(StorageRepository).unlink.mockResolvedValue();
|
||||
jobRepo.waitForQueueCompletion.mockResolvedValue();
|
||||
jobRepo.getJobCounts.mockResolvedValue({ active: 0, waiting: 0, completed: 0, delayed: 0, failed: 0, paused: 0 });
|
||||
jobRepo.getJobCounts.mockResolvedValue({ active: 0, waiting: 0, completed: 0, delayed: 0, failed: 0 });
|
||||
jobRepo.queueAll.mockResolvedValue();
|
||||
|
||||
const { user } = await ctx.newUser();
|
||||
@@ -549,7 +549,7 @@ describe(PersonService.name, () => {
|
||||
const jobRepo = ctx.getMock(JobRepository);
|
||||
ctx.getMock(StorageRepository).unlink.mockResolvedValue();
|
||||
jobRepo.waitForQueueCompletion.mockResolvedValue();
|
||||
jobRepo.getJobCounts.mockResolvedValue({ active: 0, waiting: 0, completed: 0, delayed: 0, failed: 0, paused: 0 });
|
||||
jobRepo.getJobCounts.mockResolvedValue({ active: 0, waiting: 0, completed: 0, delayed: 0, failed: 0 });
|
||||
jobRepo.queueAll.mockResolvedValue();
|
||||
|
||||
const { user } = await ctx.newUser();
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
const { icon, title, subtitle } = $derived(asQueueItem($t, queue));
|
||||
const { statistics } = $derived(queue);
|
||||
let waitingCount = $derived(statistics.waiting + statistics.paused + statistics.delayed);
|
||||
let waitingCount = $derived(statistics.waiting + statistics.delayed);
|
||||
let isIdle = $derived(statistics.active + statistics.waiting === 0 && !queue.isPaused);
|
||||
let multipleButtons = $derived(allText || refreshText);
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
|
||||
<div class="mb-4 flex gap-1">
|
||||
<Badge>{$t('active_count', { values: { count: queue.statistics.active } })}</Badge>
|
||||
<Badge>{$t('waiting_count', { values: { count: queue.statistics.waiting + queue.statistics.paused } })}</Badge>
|
||||
<Badge>{$t('waiting_count', { values: { count: queue.statistics.waiting } })}</Badge>
|
||||
{#if queue.statistics.failed > 0}
|
||||
<Badge color="danger">{$t('failed_count', { values: { count: queue.statistics.failed } })}</Badge>
|
||||
{/if}
|
||||
|
||||
@@ -15,7 +15,7 @@ export const load = (async ({ params, url }) => {
|
||||
|
||||
const [queue, failedJobs] = await Promise.all([
|
||||
getQueue({ name }),
|
||||
getQueueJobs({ name, status: [QueueJobStatus.Failed, QueueJobStatus.Paused] }),
|
||||
getQueueJobs({ name, status: [QueueJobStatus.Failed] }),
|
||||
]);
|
||||
const $t = await getFormatter();
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
if (statistics) {
|
||||
items[1].push(statistics.failed);
|
||||
items[2].push(statistics.active);
|
||||
items[3].push(statistics.waiting + statistics.paused);
|
||||
items[3].push(statistics.waiting);
|
||||
} else {
|
||||
items[0].push(timestamp);
|
||||
items[1].push(null);
|
||||
|
||||
Reference in New Issue
Block a user