Skip to content

Commit

Permalink
Use tokio::sync::Mutex to protext response_cache
Browse files Browse the repository at this point in the history
  • Loading branch information
akiradeveloper committed Nov 1, 2024
1 parent 22f1fac commit be6c15a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion sorock/src/process/command_log/consumer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ impl CommandLog {
};

if do_process {
let mut response_cache = self.response_cache.lock();
let mut response_cache = self.response_cache.lock().await;
debug!("process user@{process_index}");
match command {
Command::Snapshot { .. } => {
Expand Down
4 changes: 2 additions & 2 deletions sorock/src/process/command_log/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub struct Inner {
pub membership_pointer: AtomicU64,

app: App,
response_cache: spin::Mutex<ResponseCache>,
response_cache: tokio::sync::Mutex<ResponseCache>,
user_completions: spin::Mutex<BTreeMap<Index, completion::UserCompletion>>,
kern_completions: spin::Mutex<BTreeMap<Index, completion::KernCompletion>>,
}
Expand All @@ -50,7 +50,7 @@ impl CommandLog {
snapshot_lock: tokio::sync::RwLock::new(()),
user_completions: spin::Mutex::new(BTreeMap::new()),
kern_completions: spin::Mutex::new(BTreeMap::new()),
response_cache: spin::Mutex::new(ResponseCache::new()),
response_cache: tokio::sync::Mutex::new(ResponseCache::new()),
};
Self(inner.into())
}
Expand Down

0 comments on commit be6c15a

Please sign in to comment.