rename read_all -> with_read_lock
This commit is contained in:
@@ -63,7 +63,7 @@ where
|
|||||||
///
|
///
|
||||||
/// Acquires a read lock and calls `access` with a reference to the underlying HashMap.
|
/// Acquires a read lock and calls `access` with a reference to the underlying HashMap.
|
||||||
/// The lock is held while `access` runs.
|
/// The lock is held while `access` runs.
|
||||||
pub async fn read_all<R, A>(&self, access: A) -> R
|
pub async fn with_read_lock<R, A>(&self, access: A) -> R
|
||||||
where
|
where
|
||||||
A: FnOnce(&HashMap<K, V>) -> R,
|
A: FnOnce(&HashMap<K, V>) -> R,
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ impl LogHandler {
|
|||||||
/// If `filter` is provided, only origins matching the filter are included.
|
/// If `filter` is provided, only origins matching the filter are included.
|
||||||
pub async fn format_logs(&self, filter: Option<&str>) -> String {
|
pub async fn format_logs(&self, filter: Option<&str>) -> String {
|
||||||
self.log_buffers
|
self.log_buffers
|
||||||
.read_all(|buffers| {
|
.with_read_lock(|buffers| {
|
||||||
if buffers.is_empty() {
|
if buffers.is_empty() {
|
||||||
return "No log sources registered yet".to_string();
|
return "No log sources registered yet".to_string();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user