mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-21 22:27:08 +00:00
Add upload_timeout to PictrsConfig (#4159)
* Add upload timeout to PictrsConfig
* Bad space 🤔
* Update PictrsConfig upload timeout to include units.
This commit is contained in:
parent
525359f7c5
commit
2070381e81
|
@ -52,6 +52,8 @@
|
||||||
# hotlinking is allowed. If that is the case for your instance, make sure that this setting is
|
# hotlinking is allowed. If that is the case for your instance, make sure that this setting is
|
||||||
# disabled.
|
# disabled.
|
||||||
cache_external_link_previews: true
|
cache_external_link_previews: true
|
||||||
|
# Timeout for uploading images to pictrs (in seconds)
|
||||||
|
upload_timeout: 30
|
||||||
}
|
}
|
||||||
# Email sending configuration. All options except login/password are mandatory
|
# Email sending configuration. All options except login/password are mandatory
|
||||||
email: {
|
email: {
|
||||||
|
|
|
@ -107,7 +107,7 @@ async fn upload(
|
||||||
client_req = client_req.header("X-Forwarded-For", addr.to_string())
|
client_req = client_req.header("X-Forwarded-For", addr.to_string())
|
||||||
};
|
};
|
||||||
let res = client_req
|
let res = client_req
|
||||||
.timeout(Duration::from_secs(30))
|
.timeout(Duration::from_secs(pictrs_config.upload_timeout))
|
||||||
.body(Body::wrap_stream(make_send(body)))
|
.body(Body::wrap_stream(make_send(body)))
|
||||||
.send()
|
.send()
|
||||||
.await
|
.await
|
||||||
|
|
|
@ -89,6 +89,10 @@ pub struct PictrsConfig {
|
||||||
/// disabled.
|
/// disabled.
|
||||||
#[default(true)]
|
#[default(true)]
|
||||||
pub cache_external_link_previews: bool,
|
pub cache_external_link_previews: bool,
|
||||||
|
|
||||||
|
/// Timeout for uploading images to pictrs (in seconds)
|
||||||
|
#[default(30)]
|
||||||
|
pub upload_timeout: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Clone, SmartDefault, Document)]
|
#[derive(Debug, Deserialize, Serialize, Clone, SmartDefault, Document)]
|
||||||
|
|
Loading…
Reference in a new issue