Skip to content

Commit

Permalink
fix(core): use createSessionFunction when loading Session from persis…
Browse files Browse the repository at this point in the history
…ted state (#2444)

Changes SessionPool's new Session loading behavior in the core module to
utilize the configured createSessionFunction if specified. This ensures
that new Sessions are instantiated using the custom session creation
logic provided by the user, improving flexibility and adherence to user
configurations.
  • Loading branch information
silva95gustavo committed May 15, 2024
1 parent 8db3908 commit 3c56b4c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/core/src/session_pool/session_pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export interface SessionPoolOptions {
/**
* Control how and when to persist the state of the session pool.
*/
persistenceOptions?: PersistenceOptions;
persistenceOptions?: PersistenceOptions;
}

/**
Expand Down Expand Up @@ -472,7 +472,7 @@ export class SessionPool extends EventEmitter {
sessionObject.sessionPool = this;
sessionObject.createdAt = new Date(sessionObject.createdAt as string);
sessionObject.expiresAt = new Date(sessionObject.expiresAt as string);
const recreatedSession = new Session(sessionObject);
const recreatedSession = await this.createSessionFunction(this, { sessionOptions: sessionObject });

if (recreatedSession.isUsable()) {
this._addSession(recreatedSession);
Expand Down

0 comments on commit 3c56b4c

Please sign in to comment.