Skip to content
Open
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
16 changes: 8 additions & 8 deletions postgres-pubsub.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,14 @@ class PostgresPubSub extends PubSub {
this.connected = true;
}

initTopics(triggers) {
// confusingly, `pgListen.connect()` will reject if the first connection attempt fails
// but then it will retry and emit a `connected` event if it later connects
// see https://github.com/andywer/pg-listen/issues/32
// so we put logic on the `connected` event
return Promise.all(triggers.map((eventName) => {
return this.pgListen.listenTo(eventName);
}));
async initTopics(triggers) {
// confusingly, `pgListen.connect()` will reject if the first connection attempt fails
// but then it will retry and emit a `connected` event if it later connects
// see https://github.com/andywer/pg-listen/issues/32
// so we put logic on the `connected` event
for (const eventName of triggers) {
await this.pgListen.listenTo(eventName);
}
}

async publish(triggerName, payload) {
Expand Down