Skip to content

Commit

Permalink
Optimize lock_and_execute_merge_updates
Browse files Browse the repository at this point in the history
  • Loading branch information
kasugamirai committed Oct 4, 2024
1 parent 23a8a0d commit 332f84c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -439,11 +439,10 @@ impl FlowProjectRedisDataManager {
&self,
) -> Result<(Vec<u8>, Vec<String>), FlowProjectRedisDataManagerError> {
self.global_lock
.lock_updates(&self.project_id, 5000, |_| {
Box::pin(async move { Ok::<(), FlowProjectRedisDataManagerError>(()) })
.lock_updates(&self.project_id, 5000, |_| async {
Ok::<(), FlowProjectRedisDataManagerError>(())
})
.await
.map_err(FlowProjectRedisDataManagerError::from)?
.await?
.await?;

self.execute_merge_updates().await
Expand Down
6 changes: 1 addition & 5 deletions websocket/crates/infra/src/persistence/redis/redis_client.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
use std::sync::Arc;

use redis::{
aio::{ConnectionLike, MultiplexedConnection},
streams::StreamMaxlen,
AsyncCommands, Client,
};
use redis::{aio::MultiplexedConnection, streams::StreamMaxlen, AsyncCommands, Client};
use serde::{Deserialize, Serialize};
use thiserror::Error;
use tokio::sync::Mutex;
Expand Down

0 comments on commit 332f84c

Please sign in to comment.