2
0
Fork 0
mirror of https://git.asonix.dog/asonix/pict-rs synced 2024-11-20 03:11:14 +00:00

Add config option for external validation timeout

This commit is contained in:
asonix 2023-09-20 19:22:49 -05:00
parent 915adc3454
commit d0646dee25
4 changed files with 13 additions and 0 deletions

View file

@ -26,6 +26,7 @@ cache_capacity = 67108864
export_path = "/mnt/exports"
[media]
external_validation_timeout = 30
max_file_size = 40
process_timeout = 30
filters = [

View file

@ -57,6 +57,7 @@ impl Args {
metrics_prometheus_address,
media_preprocess_steps,
media_external_validation,
media_external_validation_timeout,
media_max_file_size,
media_process_timeout,
media_retention_variants,
@ -185,6 +186,7 @@ impl Args {
process_timeout: media_process_timeout,
preprocess_steps: media_preprocess_steps,
external_validation: media_external_validation,
external_validation_timeout: media_external_validation_timeout,
filters: media_filters,
retention: retention.set(),
image: image.set(),
@ -553,6 +555,8 @@ struct Media {
#[serde(skip_serializing_if = "Option::is_none")]
external_validation: Option<Url>,
#[serde(skip_serializing_if = "Option::is_none")]
external_validation_timeout: Option<u64>,
#[serde(skip_serializing_if = "Option::is_none")]
filters: Option<Vec<String>>,
#[serde(skip_serializing_if = "Option::is_none")]
retention: Option<Retention>,
@ -892,6 +896,10 @@ struct Run {
#[arg(long)]
media_external_validation: Option<Url>,
/// Timeout for requests to the external validation endpoint
#[arg(long)]
media_external_validation_timeout: Option<u64>,
/// Which media filters should be enabled on the `process` endpoint
#[arg(long)]
media_filters: Option<Vec<String>>,

View file

@ -64,6 +64,7 @@ struct OpenTelemetryDefaults {
#[derive(Clone, Debug, serde::Serialize)]
#[serde(rename_all = "snake_case")]
struct MediaDefaults {
external_validation_timeout: u64,
max_file_size: usize,
process_timeout: u64,
filters: Vec<String>,
@ -220,6 +221,7 @@ impl Default for OpenTelemetryDefaults {
impl Default for MediaDefaults {
fn default() -> Self {
MediaDefaults {
external_validation_timeout: 30,
max_file_size: 40,
process_timeout: 30,
filters: vec![

View file

@ -167,6 +167,8 @@ pub(crate) struct OldDb {
pub(crate) struct Media {
pub(crate) external_validation: Option<Url>,
pub(crate) external_validation_timeout: u64,
pub(crate) max_file_size: usize,
pub(crate) process_timeout: u64,