removed singletop pattern from queue manager
This commit is contained in:
parent
eeb5d1aca2
commit
db3aa9c330
12 changed files with 504 additions and 380 deletions
|
|
@ -188,19 +188,18 @@ export function createServiceContainer(rawConfig: unknown): AwilixContainer<Serv
|
|||
registrations.questdbClient = asValue(null);
|
||||
}
|
||||
|
||||
// Queue manager - placeholder until decoupled from singleton
|
||||
registrations.queueManager = asFunction(({ redisConfig, cache, logger }) => {
|
||||
// Import dynamically to avoid circular dependency
|
||||
// Queue manager - properly instantiated with DI
|
||||
registrations.queueManager = asFunction(({ redisConfig, logger }) => {
|
||||
const { QueueManager } = require('@stock-bot/queue');
|
||||
|
||||
// Check if already initialized (singleton pattern)
|
||||
if (QueueManager.isInitialized()) {
|
||||
return QueueManager.getInstance();
|
||||
}
|
||||
|
||||
// Initialize if not already done
|
||||
return QueueManager.initialize({
|
||||
redis: { host: redisConfig.host, port: redisConfig.port, db: redisConfig.db },
|
||||
|
||||
return new QueueManager({
|
||||
redis: {
|
||||
host: redisConfig.host,
|
||||
port: redisConfig.port,
|
||||
db: redisConfig.db,
|
||||
password: redisConfig.password,
|
||||
username: redisConfig.username,
|
||||
},
|
||||
enableScheduledJobs: true,
|
||||
delayWorkerStart: true, // We'll start workers manually
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue