Read BB sync status from per-ship apply state

This commit is contained in:
2026-06-11 17:33:52 -04:00
parent 351cdf757c
commit 9ed9dfd47b
+16 -16
View File
@@ -445,11 +445,13 @@ def bb_sync_info(account_id):
regions = { regions = {
"us": { "us": {
"host": "psopeeps_us", "host": "psopeeps_us",
"targets": ["us-live", "us-test", "us-hardcore"],
"status": "pending", "status": "pending",
"applied_at": None, "applied_at": None,
}, },
"eu": { "eu": {
"host": "psopeeps_eu", "host": "psopeeps_eu",
"targets": ["eu-live", "eu-test", "eu-hardcore"],
"status": "pending", "status": "pending",
"applied_at": None, "applied_at": None,
}, },
@@ -463,17 +465,21 @@ def bb_sync_info(account_id):
} }
for region, info in regions.items(): for region, info in regions.items():
state_path = root / "state" / "applied" / f"{info['host']}.site.{aid}.json" applied_times = []
state = read_json_file(state_path) all_current = True
if state and state.get("manifest_sha256") == manifest_sha: for target in info["targets"]:
info["status"] = "current" state_path = root / "state" / "applied" / f"{info['host']}.{target}.site.{aid}.json"
info["applied_at"] = state.get("applied_at") state = read_json_file(state_path)
elif state:
info["status"] = "pending" if state and state.get("applied_at"):
info["applied_at"] = state.get("applied_at") applied_times.append(state.get("applied_at"))
else:
info["status"] = "pending" 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" 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): def bb_payload(account_id, username):
sync = bb_sync_info(account_id) sync = bb_sync_info(account_id)
return { return {