Skip to content

Commit

Permalink
Merge pull request #2 from remind101/pg_listener_should_recover_from_…
Browse files Browse the repository at this point in the history
…unexpected_eof

Make PgListener recover from UnexpectedEof
  • Loading branch information
rex-remind101 authored Sep 29, 2023
2 parents a2ff86c + 80a3ce2 commit 5624992
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion sqlx-postgres/src/listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,10 @@ impl PgListener {

// The connection is dead, ensure that it is dropped,
// update self state, and loop to try again.
Err(Error::Io(err)) if err.kind() == io::ErrorKind::ConnectionAborted => {
Err(Error::Io(err))
if (err.kind() == io::ErrorKind::ConnectionAborted
|| err.kind() == io::ErrorKind::UnexpectedEof) =>
{
self.buffer_tx = self.connection().await?.stream.notifications.take();
self.connection = None;

Expand Down

0 comments on commit 5624992

Please sign in to comment.