| 159 | } |
| 160 | |
| 161 | pub async fn get_async_redis_conn() -> Result<AsyncRedisPoolConnection> { |
| 162 | let pool = get_async_redis_pool().await?; |
| 163 | |
| 164 | let start = Instant::now(); |
| 165 | let res = match pool { |
| 166 | AsyncRedisPool::Client(v) => AsyncRedisPoolConnection::Client(v.get().await?), |
| 167 | AsyncRedisPool::ClusterClient(v) => { |
| 168 | AsyncRedisPoolConnection::ClusterClient(v.clone().get().await?) |
| 169 | } |
| 170 | }; |
| 171 | |
| 172 | STORAGE_REDIS_CONN_GET.observe(start.elapsed().as_secs_f64()); |
| 173 | |
| 174 | Ok(res) |
| 175 | } |
| 176 | |
| 177 | pub async fn run_db_migrations() -> Result<()> { |
| 178 | info!("Applying schema migrations"); |