mirror of
https://github.com/launchbadge/sqlx
synced 2024-11-10 14:34:19 +00:00
pool: handle reconnects during "boot"
This commit is contained in:
parent
f677748a3b
commit
ed9d6c3b62
1 changed files with 7 additions and 6 deletions
|
@ -220,13 +220,14 @@ where
|
|||
// successfully established connection
|
||||
Ok(Ok(raw)) => Ok(Some(Floating::new_live(raw, guard))),
|
||||
|
||||
// IO error while connecting, this should definitely be logged
|
||||
// and we should attempt to retry
|
||||
Ok(Err(crate::Error::Io(e))) => {
|
||||
log::warn!("error establishing a connection: {}", e);
|
||||
// an IO error while connecting is assumed to be the system starting up
|
||||
Ok(Err(crate::Error::Io(_))) => Ok(None),
|
||||
|
||||
Ok(None)
|
||||
}
|
||||
// TODO: Handle other database "boot period"s
|
||||
|
||||
// [postgres] the database system is starting up
|
||||
// TODO: Make this check actually check if this is postgres
|
||||
Ok(Err(crate::Error::Database(error))) if error.code() == Some("57P03") => Ok(None),
|
||||
|
||||
// Any other error while connection should immediately
|
||||
// terminate and bubble the error up
|
||||
|
|
Loading…
Reference in a new issue