Snapshot of uncommitted work: landing, bots, prod infra, partner cabinet, backoffice stage 1
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
45d7512d2b
commit
d452824c62
314 files changed
+44394
-121
No files matched your search
@@ -0,0 +1,21 @@
|
||||
import { Queue } from 'bullmq';
|
||||
import { EVENTS_QUEUE, type DomainEvent, type Notifier } from './context.ts';
|
||||
|
||||
export function redisConnection(url: string) {
|
||||
const u = new URL(url);
|
||||
return { host: u.hostname, port: Number(u.port || 6379), password: u.password || undefined, maxRetriesPerRequest: null };
|
||||
}
|
||||
|
||||
/** Notifier, который кладёт доменные события в очередь воркера */
|
||||
export function createQueueNotifier(redisUrl: string): Notifier & { queue: Queue<DomainEvent> } {
|
||||
const queue = new Queue<DomainEvent>(EVENTS_QUEUE, {
|
||||
connection: redisConnection(redisUrl),
|
||||
defaultJobOptions: { attempts: 5, backoff: { type: 'exponential', delay: 2000 }, removeOnComplete: 1000, removeOnFail: 5000 },
|
||||
});
|
||||
return {
|
||||
queue,
|
||||
async emit(event) {
|
||||
await queue.add(event.type, event);
|
||||
},
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user