drop states in block
This commit is contained in:
@@ -86,6 +86,7 @@ impl Downloader {
|
|||||||
.map_err(|e| (StatusCode::INTERNAL_SERVER_ERROR, e.to_string()))?;
|
.map_err(|e| (StatusCode::INTERNAL_SERVER_ERROR, e.to_string()))?;
|
||||||
|
|
||||||
// notify all waiters
|
// notify all waiters
|
||||||
|
{
|
||||||
let mut states = self.states.lock().await;
|
let mut states = self.states.lock().await;
|
||||||
let state = states.remove(target_url).unwrap();
|
let state = states.remove(target_url).unwrap();
|
||||||
state.result.lock().await.replace(Ok(DownloadData {
|
state.result.lock().await.replace(Ok(DownloadData {
|
||||||
@@ -93,7 +94,7 @@ impl Downloader {
|
|||||||
headers: headers.clone(),
|
headers: headers.clone(),
|
||||||
}));
|
}));
|
||||||
state.notify.notify_waiters();
|
state.notify.notify_waiters();
|
||||||
drop(states);
|
}
|
||||||
|
|
||||||
Ok(DownloadData { body, headers })
|
Ok(DownloadData { body, headers })
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user