Skip to content

Commit

Permalink
Merge pull request #14 from joshbetz/feat/disable-forward-pool-errors
Browse files Browse the repository at this point in the history
remove forwardPoolErrors
  • Loading branch information
joshbetz authored Nov 27, 2024
2 parents 21509c4 + 107df4f commit 65c1134
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
2 changes: 0 additions & 2 deletions src/hashpool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ export default class HashPool extends EventEmitter {
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 @@ export type PoolOptions = {
idleTimeoutMillis: number;

// internal
forwardPoolErrors: boolean;
autostart: boolean;
fifo: boolean;
evictionRunIntervalMillis: number;
Expand All @@ -25,8 +24,6 @@ export default class Pool extends EventEmitter {
super();

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

// Pool options
max: 10,
min: 2,
Expand All @@ -46,9 +43,11 @@ export default class Pool extends EventEmitter {
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

0 comments on commit 65c1134

Please sign in to comment.