Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions crates/horismos/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,15 @@ mod tests {
assert_eq!(config.kritike.scan_interval_hours, 24);
}

#[test]
fn default_komide_config_has_correct_values() {
let config = Config::default();
assert_eq!(config.komide.max_feed_bytes, 20 * 1024 * 1024);
assert_eq!(config.komide.max_episode_bytes, 1024 * 1024 * 1024);
assert_eq!(config.komide.max_backoff_minutes, 240);
assert_eq!(config.komide.fetch_timeout_secs, 30);
}

#[test]
fn default_syndesmos_config_has_correct_values() {
let config = Config::default();
Expand Down
6 changes: 6 additions & 0 deletions crates/horismos/src/subsystems.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,10 @@ pub struct KomideConfig {
pub auto_download_latest_n: u64,
/// Request timeout for feed fetches in seconds.
pub fetch_timeout_secs: u64,
/// Maximum feed response body size in bytes; larger responses are rejected.
pub max_feed_bytes: u64,
/// Maximum episode download size in bytes; larger downloads are rejected.
pub max_episode_bytes: u64,
/// Maximum exponential-backoff window (minutes) between feed polls after
/// consecutive failures.
pub max_backoff_minutes: u64,
Expand All @@ -421,6 +425,8 @@ impl Default for KomideConfig {
news_retention_articles: 500,
auto_download_latest_n: 3,
fetch_timeout_secs: 30,
max_feed_bytes: 20 * 1024 * 1024,
max_episode_bytes: 1024 * 1024 * 1024,
max_backoff_minutes: 240,
jitter_percent: 10.0,
}
Expand Down
1 change: 1 addition & 0 deletions crates/komide/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jiff = { workspace = true }
rstest = { workspace = true }
tokio = { workspace = true, features = ["full"] }
sqlx = { workspace = true }
tempfile = "3"

[package.metadata.kanon]
maturity = "alpha"
Expand Down
8 changes: 8 additions & 0 deletions crates/komide/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ pub enum KomideError {
location: snafu::Location,
},

#[snafu(display("response body for {url} exceeds the {limit}-byte cap"))]
ResponseTooLarge {
url: String,
limit: u64,
#[snafu(implicit)]
location: snafu::Location,
},

#[snafu(display("invalid feed URL: {url}"))]
InvalidUrl {
url: String,
Expand Down
Loading