diff --git a/src/memcached.ts b/src/memcached.ts index f956fb8..85e9766 100644 --- a/src/memcached.ts +++ b/src/memcached.ts @@ -117,6 +117,11 @@ export default class Memcached extends EventEmitter { } this.client.write( command ); + + setTimeout( () => { + this.client.removeAllListeners(); + reject( new Error( 'Command Timeout' ) ); + }, Math.max( this.opts.socketTimeout, 1000 ) ).unref(); } ); }