Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion codegen/src/worktable/generator/queries/delete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ impl Generator {
#delete_logic

lock.unlock(); // Releases locks
self.0.lock_map.remove_with_lock_check(&pk).await; // Removes locks
self.0.lock_map.remove_with_lock_check(&pk); // Removes locks

core::result::Result::Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion codegen/src/worktable/generator/queries/in_place.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ impl Generator {
};

lock.unlock();
self.0.lock_map.remove_with_lock_check(&pk).await;
self.0.lock_map.remove_with_lock_check(&pk);

Ok(())
}
Expand Down
14 changes: 7 additions & 7 deletions codegen/src/worktable/generator/queries/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ impl Generator {

self.0.update_state.remove(&pk);
lock.unlock();
self.0.lock_map.remove_with_lock_check(&pk).await; // Removes locks
self.0.lock_map.remove_with_lock_check(&pk); // Removes locks

return core::result::Result::Ok(());
}
Expand Down Expand Up @@ -119,7 +119,7 @@ impl Generator {
self.0.update_state.remove(&pk);

lock.unlock(); // Releases locks
self.0.lock_map.remove_with_lock_check(&pk).await; // Removes locks
self.0.lock_map.remove_with_lock_check(&pk); // Removes locks

#persist_call

Expand Down Expand Up @@ -273,7 +273,7 @@ impl Generator {
}

lock.unlock(); // Releases locks
self.0.lock_map.remove_with_lock_check(&pk).await; // Removes locks
self.0.lock_map.remove_with_lock_check(&pk); // Removes locks

return core::result::Result::Ok(());
}
Expand Down Expand Up @@ -490,7 +490,7 @@ impl Generator {
#diff_process_remove

lock.unlock();
self.0.lock_map.remove_with_lock_check(&pk).await;
self.0.lock_map.remove_with_lock_check(&pk);

#persist_call

Expand Down Expand Up @@ -566,7 +566,7 @@ impl Generator {
}

lock.unlock(); // Releases locks
self.0.lock_map.remove_with_lock_check(&pk).await; // Removes locks
self.0.lock_map.remove_with_lock_check(&pk); // Removes locks

continue;
} else {
Expand Down Expand Up @@ -633,7 +633,7 @@ impl Generator {
}
for (pk, lock) in pk_to_unlock {
lock.unlock();
self.0.lock_map.remove_with_lock_check(&pk).await;
self.0.lock_map.remove_with_lock_check(&pk);
}
core::result::Result::Ok(())
}
Expand Down Expand Up @@ -721,7 +721,7 @@ impl Generator {
#diff_process_remove

lock.unlock();
self.0.lock_map.remove_with_lock_check(&pk).await;
self.0.lock_map.remove_with_lock_check(&pk);

#persist_call

Expand Down
5 changes: 3 additions & 2 deletions src/lock/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,14 @@ where
}

#[allow(clippy::await_holding_lock)]
pub async fn remove_with_lock_check(&self, key: &PrimaryKey)
pub fn remove_with_lock_check(&self, key: &PrimaryKey)
where
LockType: RowLock,
{
let mut set = self.map.write();
if let Some(lock) = set.get(key).cloned()
&& let Ok(guard) = lock.try_read()
&& let Ok(guard) = lock.try_write()
&& Arc::strong_count(&lock) == 1
&& !guard.is_locked()
{
set.remove(key);
Expand Down
Loading