feat: add log for deleting piece (#656)

Signed-off-by: Gaius <gaius.qi@gmail.com>
This commit is contained in:
Gaius 2024-08-06 21:21:47 +08:00 committed by GitHub
parent 36084807d3
commit 28d17f9980
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 26 additions and 23 deletions

View File

@ -787,7 +787,10 @@ impl<E: StorageEngineOwned> Metadata<E> {
for ele in iter {
let (key, _) = ele?;
info!("delete piece metadata {}", task_id);
info!(
"delete piece metadata {}",
std::str::from_utf8(&key).unwrap_or_default().to_string()
);
self.db.delete::<Piece>(&key)?;
}

View File

@ -1135,28 +1135,6 @@ impl Task {
created_at: Some(prost_wkt_types::Timestamp::from(metadata.created_at)),
};
// Send the download piece finished request.
in_stream_tx
.send_timeout(
AnnouncePeerRequest {
host_id: host_id.to_string(),
task_id: task_id.clone(),
peer_id: peer_id.to_string(),
request: Some(
announce_peer_request::Request::DownloadPieceBackToSourceFinishedRequest(
DownloadPieceBackToSourceFinishedRequest {
piece: Some(piece.clone()),
},
),
),
},
REQUEST_TIMEOUT,
)
.await.map_err(|err| {
error!("send DownloadPieceBackToSourceFinishedRequest failed: {:?}", err);
err
})?;
// Send the download progress.
download_progress_tx
.send_timeout(
@ -1180,6 +1158,28 @@ impl Task {
err
})?;
// Send the download piece finished request.
in_stream_tx
.send_timeout(
AnnouncePeerRequest {
host_id: host_id.to_string(),
task_id: task_id.clone(),
peer_id: peer_id.to_string(),
request: Some(
announce_peer_request::Request::DownloadPieceBackToSourceFinishedRequest(
DownloadPieceBackToSourceFinishedRequest {
piece: Some(piece.clone()),
},
),
),
},
REQUEST_TIMEOUT,
)
.await.map_err(|err| {
error!("send DownloadPieceBackToSourceFinishedRequest failed: {:?}", err);
err
})?;
info!(
"finished piece {} from source",
storage.piece_id(task_id.as_str(), piece.number)