refactor: Minor improvements, some extra comments
This commit is contained in:
committed by
Ivan Enderlin
parent
54e4cb2d10
commit
11f2bf0ad6
@@ -82,12 +82,9 @@ impl EventCacheStoreLock {
|
||||
|
||||
/// Acquire a spin lock (see [`CrossProcessLock::spin_lock`]).
|
||||
pub async fn lock(&self) -> Result<EventCacheStoreLockState, CrossProcessLockError> {
|
||||
let lock_state =
|
||||
self.cross_process_lock.spin_lock(None).await??.map(|cross_process_lock_guard| {
|
||||
EventCacheStoreLockGuard { cross_process_lock_guard, store: self.store.clone() }
|
||||
});
|
||||
|
||||
Ok(lock_state)
|
||||
Ok(self.cross_process_lock.spin_lock(None).await??.map(|cross_process_lock_guard| {
|
||||
EventCacheStoreLockGuard { cross_process_lock_guard, store: self.store.clone() }
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -457,6 +457,8 @@ where
|
||||
// lock in `try_lock_once` should sequentialize it all.
|
||||
|
||||
loop {
|
||||
// If the cross-process lock config is not `MultiProcess`, this behaves as a
|
||||
// no-op and we just return
|
||||
let lock_result = self.try_lock_once().await?;
|
||||
|
||||
if lock_result.is_ok() {
|
||||
|
||||
Reference in New Issue
Block a user