Skip to content

Pool with disabled retry_connection stuck until timeout #260

@apatrushev

Description

@apatrushev

Pool created with all-default options and disabled retry_connection do not return error immediately after fail but waits until timeout will occur. Minimal possible example:

struct Manager;

impl bb8::ManageConnection for Manager {
    type Connection = ();
    type Error = ();

    async fn connect(&self) -> Result<Self::Connection, Self::Error> {
        Err(())
    }

    async fn is_valid(&self, _conn: &mut Self::Connection) -> Result<(), Self::Error> {
        Ok(())
    }

    fn has_broken(&self, _conn: &mut Self::Connection) -> bool {
        false
    }
}

#[tokio::main(flavor = "current_thread")]
async fn main() {
    let pool = bb8::Builder::new()
        .retry_connection(false)
        .build(Manager)
        .await
        .unwrap();
    let started = std::time::Instant::now();
    pool.get().await.ok();
    assert!(started.elapsed().as_secs() < 1);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions