mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-30 08:49:26 +00:00
fix(scanner): reject duplicate usage updates (#6445)
* fix(scanner): reject duplicate usage updates * style: format decommission test imports * fix(ci): remove unused decommission and healing facades * fix(ci): cfg-gate test-only usage overlay import --------- Co-authored-by: houseme <housemecn@gmail.com>
This commit is contained in:
@@ -751,16 +751,29 @@ pub(super) async fn persist_and_publish_cache_snapshot(
|
||||
}
|
||||
|
||||
pub(super) async fn send_data_usage_update(updates: &mpsc::Sender<DataUsageInfo>, data_usage_info: DataUsageInfo) -> Result<()> {
|
||||
updates.send(data_usage_info).await.map_err(|e| {
|
||||
error!(
|
||||
target: "rustfs::scanner::io",
|
||||
event = EVENT_SCANNER_DATA_USAGE_STREAM,
|
||||
component = LOG_COMPONENT_SCANNER,
|
||||
subsystem = LOG_SUBSYSTEM_IO,
|
||||
state = "send_failed",
|
||||
error = %e,
|
||||
"Scanner data usage publish failed"
|
||||
);
|
||||
StorageError::other("scanner data usage receiver closed before update delivery")
|
||||
})
|
||||
match updates.try_send(data_usage_info) {
|
||||
Ok(()) => Ok(()),
|
||||
Err(mpsc::error::TrySendError::Closed(_)) => {
|
||||
error!(
|
||||
target: "rustfs::scanner::io",
|
||||
event = EVENT_SCANNER_DATA_USAGE_STREAM,
|
||||
component = LOG_COMPONENT_SCANNER,
|
||||
subsystem = LOG_SUBSYSTEM_IO,
|
||||
state = "send_failed",
|
||||
"Scanner data usage publish failed because the receiver is closed"
|
||||
);
|
||||
Err(StorageError::other("scanner data usage receiver closed before update delivery"))
|
||||
}
|
||||
Err(mpsc::error::TrySendError::Full(_)) => {
|
||||
error!(
|
||||
target: "rustfs::scanner::io",
|
||||
event = EVENT_SCANNER_DATA_USAGE_STREAM,
|
||||
component = LOG_COMPONENT_SCANNER,
|
||||
subsystem = LOG_SUBSYSTEM_IO,
|
||||
state = "send_would_block",
|
||||
"Scanner data usage publish rejected because an update is already queued"
|
||||
);
|
||||
Err(StorageError::other("scanner data usage update already queued"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user