Skip to content

Commit 01421c8

Browse files
committed
refactor: dont hold pgpool in schema cache
1 parent 7c29b74 commit 01421c8

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

crates/schema_cache/src/lib.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,17 @@ use sqlx::postgres::PgPool;
1111

1212
#[derive(Debug, Clone)]
1313
struct SchemaCacheManager {
14-
pool: PgPool,
1514
pub cache: SchemaCache,
1615
}
1716

1817
impl SchemaCacheManager {
19-
pub async fn init(pool: PgPool) -> Self {
18+
pub async fn init(pool: &PgPool) -> Self {
2019
SchemaCacheManager {
21-
cache: SchemaCache::load(&pool).await,
22-
pool,
20+
cache: SchemaCache::load(pool).await,
2321
}
2422
}
2523

26-
pub async fn reload_cache(&mut self) {
27-
self.cache = SchemaCache::load(&self.pool).await;
24+
pub async fn reload_cache(&mut self, pool: &PgPool) {
25+
self.cache = SchemaCache::load(pool).await;
2826
}
2927
}

0 commit comments

Comments
 (0)