Skip to content

Commit 2524083

Browse files
committed
build
1 parent f82ca1b commit 2524083

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

cf/src/connection.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -431,10 +431,8 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
431431
lifeTimer.cancel()
432432
connectTimer.cancel()
433433

434-
if (socket.encrypted) {
435-
socket.removeAllListeners()
436-
socket = null
437-
}
434+
socket.removeAllListeners()
435+
socket = null
438436

439437
if (initial)
440438
return reconnect()
@@ -792,7 +790,7 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
792790
const error = Errors.postgres(parseError(x))
793791
query && query.retried
794792
? errored(query.retried)
795-
: query && retryRoutines.has(error.routine)
793+
: query && query.prepared && retryRoutines.has(error.routine)
796794
? retry(query, error)
797795
: errored(error)
798796
}

cf/src/subscribe.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export default function Subscribe(postgres, options) {
4848

4949
return subscribe
5050

51-
async function subscribe(event, fn, onsubscribe = noop) {
51+
async function subscribe(event, fn, onsubscribe = noop, onerror = noop) {
5252
event = parseEvent(event)
5353

5454
if (!connection)
@@ -67,6 +67,7 @@ export default function Subscribe(postgres, options) {
6767
return connection.then(x => {
6868
connected(x)
6969
onsubscribe()
70+
stream && stream.on('error', onerror)
7071
return { unsubscribe, state, sql }
7172
})
7273
}
@@ -110,8 +111,10 @@ export default function Subscribe(postgres, options) {
110111
function data(x) {
111112
if (x[0] === 0x77)
112113
parse(x.subarray(25), state, sql.options.parsers, handle, options.transform)
113-
else if (x[0] === 0x6b && x[17])
114+
else if (x[0] === 0x6b && x[17]) {
115+
state.lsn = x.subarray(1, 9)
114116
pong()
117+
}
115118
}
116119

117120
function handle(a, b) {

0 commit comments

Comments
 (0)