Comparing version 0.0.9 to 0.0.10
@@ -41,3 +41,3 @@ 'use strict' | ||
if (this.state === states.closing) { | ||
return | ||
return Promise.resolve() | ||
} | ||
@@ -95,12 +95,7 @@ | ||
if (this.state === states.closing) { | ||
return | ||
return Promise.resolve() | ||
} | ||
// needed to support this as drop-in replacement for mqemitter | ||
const handler = (value) => { | ||
let payload = value | ||
try { | ||
payload = sjson.parse(value) | ||
} catch {} | ||
const handler = (payload) => { | ||
listener({ payload }, () => {}) | ||
@@ -191,5 +186,5 @@ } | ||
close () { | ||
async close () { | ||
if (this.state === states.closing) { | ||
return Promise.resolve() | ||
return | ||
} | ||
@@ -199,7 +194,6 @@ this.state = states.closing | ||
this.queue = [] | ||
this.ee.removeAllListeners() | ||
if (this.client) { | ||
return this.client.end() | ||
await this.client.end() | ||
} | ||
return Promise.resolve() | ||
} | ||
@@ -246,2 +240,7 @@ | ||
debug('[_setupClient] notification', message) | ||
try { | ||
message.payload = sjson.parse(message.payload) | ||
} catch {} | ||
this.ee.emit(message.channel, message.payload) | ||
@@ -248,0 +247,0 @@ }) |
{ | ||
"name": "pg-notify", | ||
"version": "0.0.9", | ||
"version": "0.0.10", | ||
"description": "Postgres pubsub client", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
13110
294