From 7e0bd14ef359db21bcad6cc75ab3bd9512f03e7c Mon Sep 17 00:00:00 2001 From: Jon Staab Date: Wed, 1 Apr 2026 16:05:15 -0700 Subject: [PATCH] Tweak relay status --- backend/spec/command.md | 2 +- backend/spec/infra.md | 2 +- backend/src/api.rs | 4 ++-- backend/src/command.rs | 2 +- backend/src/infra.rs | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/backend/spec/command.md b/backend/spec/command.md index 220c0e1..47621d0 100644 --- a/backend/spec/command.md +++ b/backend/spec/command.md @@ -32,7 +32,7 @@ Notes: ## `pub fn create_relay(&self, relay: &Relay) -> Result<()>` - Creates relay, may throw sqlite uniqueness error on subdomain -- Sets relay status to `new` +- Sets relay status to `active` - Logs activity as `(create_relay, relay_id)` ## `pub fn update_relay(&self, relay: &Relay) -> Result<()>` diff --git a/backend/spec/infra.md b/backend/spec/infra.md index 2f66ffc..c372d49 100644 --- a/backend/spec/infra.md +++ b/backend/spec/infra.md @@ -21,7 +21,7 @@ Members: ## `async fn catch_up(&self)` -- Lists all relays via `query.list_relays()` and syncs any that have `status = "new"` or a non-empty `sync_error`. +- Lists all relays via `query.list_relays()` and syncs any where `synced == 0` and `sync_error` is empty. ## `async fn handle_activity(&self, activity: &Activity)` diff --git a/backend/src/api.rs b/backend/src/api.rs index cf48c4c..78cef2e 100644 --- a/backend/src/api.rs +++ b/backend/src/api.rs @@ -193,7 +193,7 @@ impl Api { relay.schema = format!("{}_{}", relay.subdomain.replace('-', "_"), relay.id); } if relay.status.is_empty() { - relay.status = "new".to_string(); + relay.status = "active".to_string(); } relay.policy_public_join = parse_bool_default(relay.policy_public_join, 0); relay.policy_strip_signatures = parse_bool_default(relay.policy_strip_signatures, 0); @@ -472,7 +472,7 @@ async fn create_relay( schema: String::new(), subdomain: payload.subdomain, plan: payload.plan, - status: "new".to_string(), + status: "active".to_string(), sync_error: String::new(), info_name: payload.info_name.unwrap_or_default(), info_icon: payload.info_icon.unwrap_or_default(), diff --git a/backend/src/command.rs b/backend/src/command.rs index ecad4b7..caabab9 100644 --- a/backend/src/command.rs +++ b/backend/src/command.rs @@ -109,7 +109,7 @@ impl Command { policy_public_join, policy_strip_signatures, groups_enabled, management_enabled, blossom_enabled, livekit_enabled, push_enabled - ) VALUES (?, ?, ?, ?, ?, 'new', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", + ) VALUES (?, ?, ?, ?, ?, 'active', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", ) .bind(&relay.id) .bind(&relay.tenant) diff --git a/backend/src/infra.rs b/backend/src/infra.rs index 71eaa07..f82593d 100644 --- a/backend/src/infra.rs +++ b/backend/src/infra.rs @@ -68,7 +68,7 @@ impl Infra { async fn catch_up(&self) -> Result<()> { let relays = self.query.list_relays().await?; for relay in relays { - if relay.status == "new" || (relay.sync_error != "" && relay.status != "inactive") { + if relay.synced == 0 && relay.sync_error.is_empty() { let is_new = relay.synced == 0; self.sync_and_report(&relay, is_new).await; }