Skip to content
Open
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
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ REDIS_URL=redis://localhost:6379
# Max connections in each of the relay's Postgres pools — writer and, when
# READ_DATABASE_URL is set, reader (default 50).
# BUZZ_DB_POOL_SIZE=50
# Read-only partition catalog audit interval, clamped to 60s..24h (default 900s).
# BUZZ_PARTITION_AUDIT_INTERVAL_SECS=900
# Emergency kill switch for monthly partition CREATE; audits remain enabled.
# BUZZ_PARTITION_MANAGER_CREATE_ENABLED=true

# -----------------------------------------------------------------------------
# Typesense (search)
Expand Down
16 changes: 13 additions & 3 deletions crates/buzz-db/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4232,10 +4232,20 @@ impl Db {
.await
}

/// Ensures monthly partitions exist for the next N months.
/// Audits the managed partition catalogs without making writes.
#[datastore_span(name = "audit_partitions", system = "postgresql")]
pub async fn audit_partitions(&self, months_ahead: u32) -> Result<partition::PartitionAudit> {
partition::audit_partition_catalog(&self.pool, months_ahead).await
}

/// Ensures monthly partitions exist for the next N months when creation is enabled.
#[datastore_span(name = "ensure_future_partitions", system = "postgresql")]
pub async fn ensure_future_partitions(&self, months_ahead: u32) -> Result<()> {
partition::ensure_future_partitions(&self.pool, months_ahead).await
pub async fn ensure_future_partitions(
&self,
months_ahead: u32,
create_enabled: bool,
) -> Result<partition::PartitionAudit> {
partition::ensure_future_partitions(&self.pool, months_ahead, create_enabled).await
}

/// Backfill `d_tag` for existing NIP-33 events (kind 30000–39999) that have `d_tag IS NULL`.
Expand Down
Loading
Loading