add factory method

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

No files matched your search

+6 -1
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);
+6 -1
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;
}
// ****************************************