Skip to content

Commit

Permalink
[core] Init store
Browse files Browse the repository at this point in the history
  • Loading branch information
devlikepro committed Jan 19, 2025
1 parent 8e566cb commit 78fb4b1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/core/engines/webjs/session.webjs.core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,10 @@ export class WhatsappSessionWebJSCore extends WhatsappSession {

protected async buildClient() {
const clientOptions = this.getClientOptions();
const base = process.env.WAHA_LOCAL_STORE_BASE_DIR || './.sessions';
clientOptions.authStrategy = new LocalAuth({
clientId: this.name,
dataPath: undefined,
dataPath: `${base}/webjs/default`,
logger: this.logger,
rmMaxRetries: undefined,
});
Expand Down
11 changes: 10 additions & 1 deletion src/core/manager.core.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
Injectable,
NotFoundException,
OnModuleInit,
UnprocessableEntityException,
} from '@nestjs/common';
import { EngineBootstrap } from '@waha/core/abc/EngineBootstrap';
Expand Down Expand Up @@ -57,7 +58,7 @@ enum DefaultSessionStatus {
}

@Injectable()
export class SessionManagerCore extends SessionManager {
export class SessionManagerCore extends SessionManager implements OnModuleInit {
SESSION_STOP_TIMEOUT = 3000;

// session - exists and running (or failed or smth)
Expand Down Expand Up @@ -390,4 +391,12 @@ export class SessionManagerCore extends SessionManager {
protected stopEvents() {
complete(this.events2);
}

async onModuleInit() {
await this.init();
}

async init() {
await this.store.init();
}
}

0 comments on commit 78fb4b1

Please sign in to comment.