feat: add log for deleting piece (#656)
Signed-off-by: Gaius <gaius.qi@gmail.com>
This commit is contained in:
parent
36084807d3
commit
28d17f9980
|
|
@ -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)?;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue