Skip to content

Commit

Permalink
chore: use protected property directly
Browse files Browse the repository at this point in the history
  • Loading branch information
B4nan committed Jul 27, 2022
1 parent b0ca311 commit a9e75f2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
3 changes: 2 additions & 1 deletion packages/core/src/session_pool/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,8 @@ export class Session {
* @returns Whether the session was retired.
*/
retireOnBlockedStatusCodes(statusCode: number, blockedStatusCodes: number[] = []): boolean {
const isBlocked = this.sessionPool.getBlockedStatusCodes(blockedStatusCodes).includes(statusCode);
// @ts-expect-error
const isBlocked = this.sessionPool.blockedStatusCodes.concat(blockedStatusCodes).includes(statusCode);
if (isBlocked) {
this.retire();
}
Expand Down
5 changes: 0 additions & 5 deletions packages/core/src/session_pool/session_pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,11 +314,6 @@ export class SessionPool extends EventEmitter {
await this.persistState();
}

/** @internal */
getBlockedStatusCodes(additionalCodes: number[] = []): number[] {
return this.blockedStatusCodes.concat(additionalCodes);
}

/**
* SessionPool should not work before initialization.
*/
Expand Down
3 changes: 2 additions & 1 deletion test/core/session_pool/session.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ describe('Session - testing session behaviour ', () => {
expect(session.retireOnBlockedStatusCodes(200)).toBeFalsy();
expect(session.retireOnBlockedStatusCodes(400)).toBeFalsy();
expect(session.retireOnBlockedStatusCodes(500)).toBeFalsy();
sessionPool.getBlockedStatusCodes().forEach((status) => {
// @ts-expect-error
sessionPool.blockedStatusCodes.forEach((status) => {
const sess = new Session({ sessionPool });
let isCalled;
const call = () => { isCalled = true; };
Expand Down

0 comments on commit a9e75f2

Please sign in to comment.