pg-logical-replication
pg-logical-replication copied to clipboard
subscribe promise does not reject when the service is stopped
The service.stop implementation removes all the listeners from the connection here https://github.com/kibae/pg-logical-replication/blob/main/src/logical-replication-service.ts#L80 which prevents the subscribe query promise from completing (rejecting) when the service is stopped and underlying connection is closed.
We have a situation where we need to handle the hearbeat loss and resubscribe, but stop-ing the service fails to end the subscribe promise (one way or the other).
Is removing the connection listeners necessary?