From 2e7f424ec3e71fd91dffabc0fb4f329acd342fda Mon Sep 17 00:00:00 2001 From: Jim Crossley Date: Tue, 30 Sep 2025 10:45:02 -0400 Subject: [PATCH] feat: disable GC for orphaned packages by default Downstream issue: https://issues.redhat.com/browse/TC-2958 (cherry picked from commit df18dbb3ca0577e6099c2b56760fb56e81931d30) --- docs/env-vars.md | 2 +- server/src/profile/api.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/env-vars.md b/docs/env-vars.md index 7bedd604e..a79fd62d6 100644 --- a/docs/env-vars.md +++ b/docs/env-vars.md @@ -41,7 +41,7 @@ | `TRUSTD_DB_PASSWORD` | Database password | `trustify` | | `TRUSTD_DB_PORT` | Database port | `5432` | | `TRUSTD_DB_USER` | Database username | `postgres` | -| `TRUSTD_GC_FREQ` | How often database garbage collection runs (humantime) | `1h` | +| `TRUSTD_GC_FREQ` | Database garbage collection frequency [disabled by default] (humantime) | `0s` | | `TRUSTD_ISSUER_URL` | Issuer URL for `--devmode` | `http://localhost:8090/realms/trustify` | | `TRUSTD_MAX_CACHE_SIZE` | Maximum size of the graph cache. | `200 MiB` | | `TRUSTD_S3_ACCESS_KEY` | S3 access key | | diff --git a/server/src/profile/api.rs b/server/src/profile/api.rs index 4a7950794..63206bfda 100644 --- a/server/src/profile/api.rs +++ b/server/src/profile/api.rs @@ -38,7 +38,7 @@ use trustify_module_storage::{ use trustify_module_ui::{UI, endpoints::UiResources}; use utoipa::openapi::{Info, License}; -const GC_FREQ: Duration = Duration::from_secs(60 * 60); +const GC_FREQ: Duration = Duration::from_secs(0); const ENV_GC_FREQ: &str = "TRUSTD_GC_FREQ"; /// Run the API server @@ -379,7 +379,7 @@ fn schedule_db_tasks(db: db::Database) { _ => GC_FREQ, }; if freq < Duration::from_secs(1) { - log::warn!("GC is disabled; to enable, set {ENV_GC_FREQ} to at least 1s"); + log::warn!("Garbage collection is disabled; to enable, set {ENV_GC_FREQ} to at least 1s"); return; } log::info!("GC frequency set to {}", humantime::Duration::from(freq));