Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
PragmaTwice committed Nov 10, 2024
1 parent e6d6a0b commit f291fc8
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions core/src/services/redis/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,7 @@ impl Adapter {
}

async fn pool(&self) -> Result<&bb8::Pool<RedisConnectionManager>> {
Ok(self
.conn
self.conn
.get_or_try_init(|| async {
bb8::Pool::builder()
.build(self.get_redis_connection_manager())
Expand All @@ -325,7 +324,7 @@ impl Adapter {
.set_source(err)
})
})
.await?)
.await
}

fn get_redis_connection_manager(&self) -> RedisConnectionManager {
Expand Down Expand Up @@ -423,17 +422,15 @@ impl kv::Adapter for Adapter {
async fn scan(&self, path: &str) -> Result<Self::Scanner> {
let pool = self.pool().await?.clone();

Ok(
RedisScanner::try_new_async_send(pool, path.to_string(), |pool, path| {
Box::pin(async {
let conn = Adapter::conn_from_pool(pool).await?;
Ok(RedisAsyncConnIter::try_new_async_send(conn, |conn| {
Box::pin(async { conn.scan(path).await })
})
.await?)
RedisScanner::try_new_async_send(pool, path.to_string(), |pool, path| {
Box::pin(async {
let conn = Adapter::conn_from_pool(pool).await?;
RedisAsyncConnIter::try_new_async_send(conn, |conn| {
Box::pin(async { conn.scan(path).await })
})
.await
})
.await?,
)
})
.await
}
}

0 comments on commit f291fc8

Please sign in to comment.