Notify when attachment download succeeds, fix deadlock in attachment store
This commit is contained in:
@@ -469,10 +469,14 @@ impl<K: AuthenticationStore + Send + Sync> HTTPAPIClient<K> {
|
||||
.expect("Unable to build request")
|
||||
};
|
||||
|
||||
log::trace!("Obtaining token from auth store");
|
||||
let token = self.auth_store.get_token().await;
|
||||
let request = build_request(&token);
|
||||
let mut response = self.client.request(request).await?;
|
||||
log::trace!("Token: {:?}", token);
|
||||
|
||||
let request = build_request(&token);
|
||||
log::trace!("Request: {:?}. Sending request...", request);
|
||||
|
||||
let mut response = self.client.request(request).await?;
|
||||
log::debug!("-> Response: {:}", response.status());
|
||||
|
||||
match response.status() {
|
||||
@@ -502,7 +506,9 @@ impl<K: AuthenticationStore + Send + Sync> HTTPAPIClient<K> {
|
||||
|
||||
// Other errors: bubble up.
|
||||
_ => {
|
||||
let message = format!("Request failed ({:})", response.status());
|
||||
let status = response.status();
|
||||
let body_str = hyper::body::to_bytes(response.into_body()).await?;
|
||||
let message = format!("Request failed ({:}). Response body: {:?}", status, String::from_utf8_lossy(&body_str));
|
||||
return Err(Error::ClientError(message));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,11 +10,11 @@ pub type MessageID = <Message as Identifiable>::ID;
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct AttributionInfo {
|
||||
/// Picture width
|
||||
#[serde(rename = "pgensh")]
|
||||
#[serde(rename = "pgensw")]
|
||||
pub width: Option<u32>,
|
||||
|
||||
/// Picture height
|
||||
#[serde(rename = "pgensw")]
|
||||
#[serde(rename = "pgensh")]
|
||||
pub height: Option<u32>,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user