[core] Move config to SessionManager

This commit is contained in:
devlikepro committed 2024-10-16 13:53:04 +07:00
1 parent 575969f938
commit 38df64c191
2 files changed
+7 -3

No files matched your search

+5 -1
View File
@@ -2,6 +2,7 @@ import {
BeforeApplicationShutdown,
UnprocessableEntityException,
} from '@nestjs/common';
import { WhatsappConfigService } from '@waha/config.service';
import { ISessionMeRepository } from '@waha/core/storage/ISessionMeRepository';
import { WAHAWebhook } from '@waha/structures/webhooks.dto';
import { waitUntil } from '@waha/utils/promiseTimeout';
@@ -39,7 +40,10 @@ export abstract class SessionManager implements BeforeApplicationShutdown {
WAIT_STATUS_INTERVAL = 500;
WAIT_STATUS_TIMEOUT = 5_000;
protected constructor(protected log: PinoLogger) {
protected constructor(
protected config: WhatsappConfigService,
protected log: PinoLogger,
) {
this.lock = new AsyncLock({ maxPending: Infinity });
this.log.setContext(SessionManager.name);
}
+2 -2
View File
@@ -64,12 +64,12 @@ export class SessionManagerCore extends SessionManager {
protected readonly EngineClass: typeof WhatsappSession;
constructor(
private config: WhatsappConfigService,
config: WhatsappConfigService,
private engineConfigService: EngineConfigService,
log: PinoLogger,
private mediaStorageFactory: MediaStorageFactory,
) {
super(log);
super(config, log);
this.events = new EventEmitter();
this.session = DefaultSessionStatus.STOPPED;
this.sessionConfig = null;