mirror of
https://github.com/immich-app/immich.git
synced 2025-05-24 01:12:58 -04:00
We've been keen to try this for a while as it means we can remove redis as a dependency, which makes Immich easier to setup and run. This replaces bullmq with a bespoke postgres queue. Jobs in the queue are processed either immediately via triggers and notifications, or eventually if a notification is missed.
21 lines
662 B
TypeScript
21 lines
662 B
TypeScript
import { JobRepository } from 'src/repositories/job.repository';
|
|
import { RepositoryInterface } from 'src/types';
|
|
import { Mocked, vitest } from 'vitest';
|
|
|
|
export const newJobRepositoryMock = (): Mocked<RepositoryInterface<JobRepository>> => {
|
|
return {
|
|
setup: vitest.fn(),
|
|
start: vitest.fn(),
|
|
stop: vitest.fn(),
|
|
pause: vitest.fn(),
|
|
resume: vitest.fn(),
|
|
run: vitest.fn(),
|
|
queue: vitest.fn().mockImplementation(() => Promise.resolve()),
|
|
queueAll: vitest.fn().mockImplementation(() => Promise.resolve()),
|
|
clear: vitest.fn(),
|
|
clearFailed: vitest.fn(),
|
|
getJobCounts: vitest.fn(),
|
|
getQueueStatus: vitest.fn(),
|
|
};
|
|
};
|