wip: docker
This commit is contained in:
10
packages/queue/src/connection.ts
Normal file
10
packages/queue/src/connection.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
const parse = (connectionString: string) => {
|
||||
const url = new URL(connectionString);
|
||||
return {
|
||||
host: url.hostname,
|
||||
port: Number(url.port),
|
||||
password: url.password,
|
||||
} as const;
|
||||
};
|
||||
|
||||
export const connection = parse(String(process.env.REDIS_URL));
|
||||
17
packages/queue/src/queues.ts
Normal file
17
packages/queue/src/queues.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { Queue } from 'bullmq';
|
||||
|
||||
import type { BatchPayload } from '@mixan/types';
|
||||
|
||||
import { connection } from './connection';
|
||||
|
||||
export interface EventsQueuePayload {
|
||||
projectId: string;
|
||||
payload: BatchPayload[];
|
||||
}
|
||||
|
||||
export const eventsQueue = new Queue<EventsQueuePayload>('events', {
|
||||
connection,
|
||||
defaultJobOptions: {
|
||||
removeOnComplete: 10,
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user