feat: Use postgres as a queue

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.
This commit is contained in:
Thomas Way
2025-04-30 20:43:51 +01:00
parent b845184c80
commit 8c0c8a8d0e
46 changed files with 731 additions and 915 deletions

View File

@@ -8,12 +8,6 @@ const envData: EnvData = {
environment: ImmichEnvironment.PRODUCTION,
buildMetadata: {},
bull: {
config: {
prefix: 'immich_bull',
},
queues: [{ name: 'queue-1' }],
},
cls: {
config: {},
@@ -52,12 +46,6 @@ const envData: EnvData = {
},
},
redis: {
host: 'redis',
port: 6379,
db: 0,
},
resourcePaths: {
lockFile: 'build-lock.json',
geodata: {

View File

@@ -5,18 +5,16 @@ import { Mocked, vitest } from 'vitest';
export const newJobRepositoryMock = (): Mocked<RepositoryInterface<JobRepository>> => {
return {
setup: vitest.fn(),
startWorkers: vitest.fn(),
run: vitest.fn(),
setConcurrency: vitest.fn(),
empty: 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()),
getQueueStatus: vitest.fn(),
getJobCounts: vitest.fn(),
clear: vitest.fn(),
waitForQueueCompletion: vitest.fn(),
removeJob: vitest.fn(),
clearFailed: vitest.fn(),
getJobCounts: vitest.fn(),
getQueueStatus: vitest.fn(),
};
};