Skip to content

Commit

Permalink
build
Browse files Browse the repository at this point in the history
  • Loading branch information
porsager committed Mar 21, 2024
1 parent f82ca1b commit 2524083
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
8 changes: 3 additions & 5 deletions cf/src/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -431,10 +431,8 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
lifeTimer.cancel()
connectTimer.cancel()

if (socket.encrypted) {
socket.removeAllListeners()
socket = null
}
socket.removeAllListeners()
socket = null

if (initial)
return reconnect()
Expand Down Expand Up @@ -792,7 +790,7 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
const error = Errors.postgres(parseError(x))
query && query.retried
? errored(query.retried)
: query && retryRoutines.has(error.routine)
: query && query.prepared && retryRoutines.has(error.routine)
? retry(query, error)
: errored(error)
}
Expand Down
7 changes: 5 additions & 2 deletions cf/src/subscribe.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default function Subscribe(postgres, options) {

return subscribe

async function subscribe(event, fn, onsubscribe = noop) {
async function subscribe(event, fn, onsubscribe = noop, onerror = noop) {
event = parseEvent(event)

if (!connection)
Expand All @@ -67,6 +67,7 @@ export default function Subscribe(postgres, options) {
return connection.then(x => {
connected(x)
onsubscribe()
stream && stream.on('error', onerror)
return { unsubscribe, state, sql }
})
}
Expand Down Expand Up @@ -110,8 +111,10 @@ export default function Subscribe(postgres, options) {
function data(x) {
if (x[0] === 0x77)
parse(x.subarray(25), state, sql.options.parsers, handle, options.transform)
else if (x[0] === 0x6b && x[17])
else if (x[0] === 0x6b && x[17]) {
state.lsn = x.subarray(1, 9)
pong()
}
}

function handle(a, b) {
Expand Down

0 comments on commit 2524083

Please sign in to comment.