Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove forwardPoolErrors #14

Merged
merged 1 commit into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/hashpool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
retries: number;
opts: HashPoolOptions;

constructor( nodes: Array<string>, opts?: any ) {

Check warning on line 22 in src/hashpool.ts

View workflow job for this annotation

GitHub Actions / build (18.x)

Unexpected any. Specify a different type

Check warning on line 22 in src/hashpool.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

Unexpected any. Specify a different type

Check warning on line 22 in src/hashpool.ts

View workflow job for this annotation

GitHub Actions / build (22.x)

Unexpected any. Specify a different type

Check warning on line 22 in src/hashpool.ts

View workflow job for this annotation

GitHub Actions / build (23.x)

Unexpected any. Specify a different type
super();

this.retries = 0;
Expand All @@ -30,7 +30,7 @@
retry: ( retries: number ): number => {
const exp = Math.pow( 2, retries ) * 250;

// exponential backoff up to 30 seconds

Check warning on line 33 in src/hashpool.ts

View workflow job for this annotation

GitHub Actions / build (18.x)

You have a misspelled word: backoff on Comment

Check warning on line 33 in src/hashpool.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

You have a misspelled word: backoff on Comment

Check warning on line 33 in src/hashpool.ts

View workflow job for this annotation

GitHub Actions / build (22.x)

You have a misspelled word: backoff on Comment

Check warning on line 33 in src/hashpool.ts

View workflow job for this annotation

GitHub Actions / build (23.x)

You have a misspelled word: backoff on Comment
return Math.min( exp, 30000 );
},
pingInterval: 60_000,
Expand All @@ -47,8 +47,6 @@
socketTimeout: 100,
}, opts );

this.opts.forwardPoolErrors = true;

// initialize hash pool
for ( const node of nodes ) {
this.connect( node );
Expand Down
11 changes: 5 additions & 6 deletions src/pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
idleTimeoutMillis: number;

// internal
forwardPoolErrors: boolean;
autostart: boolean;
fifo: boolean;
evictionRunIntervalMillis: number;
Expand All @@ -21,12 +20,10 @@
pool: GenericPool<Memcached>;
opts: PoolOptions;

constructor( port: number, host: string, opts?: any ) {

Check warning on line 23 in src/pool.ts

View workflow job for this annotation

GitHub Actions / build (18.x)

Unexpected any. Specify a different type

Check warning on line 23 in src/pool.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

Unexpected any. Specify a different type

Check warning on line 23 in src/pool.ts

View workflow job for this annotation

GitHub Actions / build (22.x)

Unexpected any. Specify a different type

Check warning on line 23 in src/pool.ts

View workflow job for this annotation

GitHub Actions / build (23.x)

Unexpected any. Specify a different type
super();

this.opts = Object.assign( {
forwardPoolErrors: false,

// Pool options
max: 10,
min: 2,
Expand All @@ -46,9 +43,11 @@
this.pool = createPool( {
create: async () => {
const memcached = new Memcached( port, host, this.opts );
if ( this.opts.forwardPoolErrors ) {
memcached.on( 'error', ( error: Error ) => this.emit( 'error', error ) );
}
memcached.on( 'error', ( error: Error ) => {
if ( this.listeners( 'error' ).length ) {
this.emit( 'error', error );
}
} );

await memcached.ready();
return memcached;
Expand Down
Loading