2
0
Fork 0
mirror of https://git.asonix.dog/asonix/pict-rs synced 2024-12-22 19:31:35 +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" export_path = "/mnt/exports"
[media] [media]
external_validation_timeout = 30
max_file_size = 40 max_file_size = 40
process_timeout = 30 process_timeout = 30
filters = [ filters = [

View file

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

View file

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

View file

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