pub async fn acquire(&self) -> Result<ConnectionGuard, CachemError> {
        let sleep = sleep(Duration::from_millis(Self::ACQUIRE_TIMEOUT_MSEC));
        tokio::pin!(sleep);

        tokio::select! {
            _ = &mut sleep => {
                Err(CachemError::ConnectionPoolError(ConnectionPoolError::TimeoutGettingConnection))
            }
            c = self.try_acquire() => {
                c
            }
        }
    }
/// Tries to acquire a connection in the given timeframe set by
/// Self::ACQUIRE_TIMEOUT_MSEC.
/// If there was no connection available it returns an error.
///
/// # Returns
///
/// If successful a connection from the pool, if not a
/// [ConnectionPoolError::TimeoutGettingConnection] error.
///
Tries to acquire a connection in the given timeframe set by
Self::ACQUIRE_TIMEOUT_MSEC.
If there was no connection available it returns an error.
Tries to acquire a connection in the given timeframe set by Self :: ACQUIRE_TIMEOUT_MSEC . If there was no connection available it returns an error .
pub async fn acquire(&self) -> Result<ConnectionGuard, CachemError> {
        let sleep = sleep(Duration::from_millis(Self::ACQUIRE_TIMEOUT_MSEC));
        tokio::pin!(sleep);
        tokio::select! {
            _ = &mut sleep => {
                Err(CachemError::ConnectionPoolError(ConnectionPoolError::TimeoutGettingConnection))
            }
            c = self.try_acquire() => {
                c
            }
        }
    }
pub async fn acquire ( & self ) -> Result < ConnectionGuard , CachemError > { let sleep = sleep ( Duration :: from_millis ( Self :: ACQUIRE_TIMEOUT_MSEC ) ) ; tokio :: pin ! ( sleep ) ; tokio :: select ! { mut sleep { Err ( CachemError ConnectionPoolError ( ConnectionPoolError TimeoutGettingConnection ) ) } c self try_acquire ( ) { c } } }
Tries to acquire a connection in the given timeframe set by
Self::ACQUIRE_TIMEOUT_MSEC.
Tries to acquire a connection in the given timeframe set by Self :: ACQUIRE_TIMEOUT_MSEC .
&self
If successful a connection from the pool, if not a
[ConnectionPoolError::TimeoutGettingConnection] error.
If successful a connection from the pool if not a [ ConnectionPoolError :: TimeoutGettingConnection ] error .
&self