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:
İsmail Karslı 2023-11-17 12:01:32 +03:00 committed by GitHub
parent 525359f7c5
commit 2070381e81
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 1 deletions

View file

@ -52,6 +52,8 @@
# hotlinking is allowed. If that is the case for your instance, make sure that this setting is
# disabled.
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: {

View file

@ -107,7 +107,7 @@ async fn upload(
client_req = client_req.header("X-Forwarded-For", addr.to_string())
};
let res = client_req
.timeout(Duration::from_secs(30))
.timeout(Duration::from_secs(pictrs_config.upload_timeout))
.body(Body::wrap_stream(make_send(body)))
.send()
.await

View file

@ -89,6 +89,10 @@ pub struct PictrsConfig {
/// disabled.
#[default(true)]
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)]