UNPKG

recoder-code

Version:

🚀 AI-powered development platform - Chat with 32+ models, build projects, automate workflows. Free models included!

51 lines (44 loc) • 1.15 kB
/** * Queue management for Plugin Registry Service */ import Bull from 'bull'; import { getRedis } from './redis'; export interface QueueManager { packageAnalysis: Bull.Queue; securityScan: Bull.Queue; downloadStats: Bull.Queue; } let queueManager: QueueManager; export function initializeQueues(): QueueManager { const redis = getRedis(); queueManager = { packageAnalysis: new Bull('package-analysis', { redis: { host: redis.options.host, port: redis.options.port, password: redis.options.password, }, }), securityScan: new Bull('security-scan', { redis: { host: redis.options.host, port: redis.options.port, password: redis.options.password, }, }), downloadStats: new Bull('download-stats', { redis: { host: redis.options.host, port: redis.options.port, password: redis.options.password, }, }), }; return queueManager; } export function getQueues(): QueueManager { if (!queueManager) { throw new Error('Queues not initialized. Call initializeQueues() first.'); } return queueManager; }