write operations optimized for less memory usage

This commit is contained in:
euzu
2025-12-11 19:27:56 +01:00
parent ab8e6c0d53
commit 1193fc2265
29 changed files with 320 additions and 187 deletions
@@ -96,7 +96,8 @@ async fn playlist_resolve_series_info(cfg: &AppConfig, client: &reqwest::Client,
write_counter += 1;
// periodic flush to bound BufWriter memory
if write_counter.is_multiple_of(FLUSH_INTERVAL) {
if write_counter >= FLUSH_INTERVAL {
write_counter = 0;
if let Err(err) = content_writer.flush() {
errors.push(notify_err!(format!("Failed periodic flush of wal content writer {err}")));
}
@@ -202,7 +203,8 @@ async fn process_series_info(
}
write_counter +=1;
// periodic flush to bound BufWriter memory
if write_counter.is_multiple_of(FLUSH_INTERVAL) {
if write_counter <= FLUSH_INTERVAL {
write_counter = 0;
if let Err(err) = wal_writer.flush() {
errors.push(notify_err!(format!("Failed periodic flush of wal content writer {err}")));
}
@@ -109,9 +109,9 @@ pub async fn playlist_resolve_vod(app_config: &AppConfig, client: &reqwest::Clie
processed_info_ids.insert(provider_id, ts);
content_updated = true;
write_counter += 1;
// periodic flush to bound BufWriter memory
if write_counter.is_multiple_of(FLUSH_INTERVAL) {
if write_counter >= FLUSH_INTERVAL {
write_counter = 0;
if let Err(err) = content_writer.flush() {
errors.push(notify_err!(format!("Failed periodic flush of wal content writer {err}")));
}