Tweak relay status

This commit is contained in:
Jon Staab
2026-04-01 16:05:15 -07:00
parent 3e131b6a1b
commit 7e0bd14ef3
5 changed files with 6 additions and 6 deletions
+1 -1
View File
@@ -32,7 +32,7 @@ Notes:
## `pub fn create_relay(&self, relay: &Relay) -> Result<()>` ## `pub fn create_relay(&self, relay: &Relay) -> Result<()>`
- Creates relay, may throw sqlite uniqueness error on subdomain - 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)` - Logs activity as `(create_relay, relay_id)`
## `pub fn update_relay(&self, relay: &Relay) -> Result<()>` ## `pub fn update_relay(&self, relay: &Relay) -> Result<()>`
+1 -1
View File
@@ -21,7 +21,7 @@ Members:
## `async fn catch_up(&self)` ## `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)` ## `async fn handle_activity(&self, activity: &Activity)`
+2 -2
View File
@@ -193,7 +193,7 @@ impl Api {
relay.schema = format!("{}_{}", relay.subdomain.replace('-', "_"), relay.id); relay.schema = format!("{}_{}", relay.subdomain.replace('-', "_"), relay.id);
} }
if relay.status.is_empty() { 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_public_join = parse_bool_default(relay.policy_public_join, 0);
relay.policy_strip_signatures = parse_bool_default(relay.policy_strip_signatures, 0); relay.policy_strip_signatures = parse_bool_default(relay.policy_strip_signatures, 0);
@@ -472,7 +472,7 @@ async fn create_relay(
schema: String::new(), schema: String::new(),
subdomain: payload.subdomain, subdomain: payload.subdomain,
plan: payload.plan, plan: payload.plan,
status: "new".to_string(), status: "active".to_string(),
sync_error: String::new(), sync_error: String::new(),
info_name: payload.info_name.unwrap_or_default(), info_name: payload.info_name.unwrap_or_default(),
info_icon: payload.info_icon.unwrap_or_default(), info_icon: payload.info_icon.unwrap_or_default(),
+1 -1
View File
@@ -109,7 +109,7 @@ impl Command {
policy_public_join, policy_strip_signatures, policy_public_join, policy_strip_signatures,
groups_enabled, management_enabled, blossom_enabled, groups_enabled, management_enabled, blossom_enabled,
livekit_enabled, push_enabled livekit_enabled, push_enabled
) VALUES (?, ?, ?, ?, ?, 'new', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", ) VALUES (?, ?, ?, ?, ?, 'active', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
) )
.bind(&relay.id) .bind(&relay.id)
.bind(&relay.tenant) .bind(&relay.tenant)
+1 -1
View File
@@ -68,7 +68,7 @@ impl Infra {
async fn catch_up(&self) -> Result<()> { async fn catch_up(&self) -> Result<()> {
let relays = self.query.list_relays().await?; let relays = self.query.list_relays().await?;
for relay in relays { 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; let is_new = relay.synced == 0;
self.sync_and_report(&relay, is_new).await; self.sync_and_report(&relay, is_new).await;
} }