add factory method

This commit is contained in:
Alex Holliday
2025-06-08 09:01:30 +08:00
parent 8de2c0387c
commit afbd1157c0
2 changed files with 12 additions and 2 deletions

View File

@@ -210,7 +210,12 @@ const startApp = async () => {
statusService,
notificationService,
});
const pulseQueue = new PulseQueue({ appSettings, db, pulseQueueHelper, logger });
const pulseQueue = await PulseQueue.create({
appSettings,
db,
pulseQueueHelper,
logger,
});
// Register services
// ServiceRegistry.register(JobQueue.SERVICE_NAME, jobQueue);

View File

@@ -10,7 +10,12 @@ class PulseQueue {
this.appSettings = appSettings;
this.pulseQueueHelper = pulseQueueHelper;
this.logger = logger;
this.init();
}
static async create({ appSettings, db, pulseQueueHelper, logger }) {
const instance = new PulseQueue({ appSettings, db, pulseQueueHelper, logger });
await instance.init();
return instance;
}
// ****************************************