From 9ed9dfd47bc767175075b33bd4cb0238774c866a Mon Sep 17 00:00:00 2001 From: James Osborne Date: Thu, 11 Jun 2026 17:33:52 -0400 Subject: [PATCH] Read BB sync status from per-ship apply state --- backend/app.py | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/backend/app.py b/backend/app.py index faa63e7..3043ade 100644 --- a/backend/app.py +++ b/backend/app.py @@ -445,11 +445,13 @@ def bb_sync_info(account_id): regions = { "us": { "host": "psopeeps_us", + "targets": ["us-live", "us-test", "us-hardcore"], "status": "pending", "applied_at": None, }, "eu": { "host": "psopeeps_eu", + "targets": ["eu-live", "eu-test", "eu-hardcore"], "status": "pending", "applied_at": None, }, @@ -463,17 +465,21 @@ def bb_sync_info(account_id): } for region, info in regions.items(): - state_path = root / "state" / "applied" / f"{info['host']}.site.{aid}.json" - state = read_json_file(state_path) + applied_times = [] + all_current = True - if state and state.get("manifest_sha256") == manifest_sha: - info["status"] = "current" - info["applied_at"] = state.get("applied_at") - elif state: - info["status"] = "pending" - info["applied_at"] = state.get("applied_at") - else: - info["status"] = "pending" + for target in info["targets"]: + state_path = root / "state" / "applied" / f"{info['host']}.{target}.site.{aid}.json" + state = read_json_file(state_path) + + if state and state.get("applied_at"): + applied_times.append(state.get("applied_at")) + + if not state or state.get("manifest_sha256") != manifest_sha: + all_current = False + + info["status"] = "current" if all_current else "pending" + info["applied_at"] = max(applied_times) if applied_times else None overall = "current" if all(x["status"] == "current" for x in regions.values()) else "pending" @@ -484,12 +490,6 @@ def bb_sync_info(account_id): } - -def account_sync_current_on_all_regions(account_id): - sync = bb_sync_info(account_id) - return sync.get("status") == "current", sync - - def bb_payload(account_id, username): sync = bb_sync_info(account_id) return {