wu-sheng opened a new pull request, #19:
URL: https://github.com/apache/skywalking-horizon-ui/pull/19

   ## Summary
   
   Fixes the case @wu-sheng surfaced (BanyanDB `sw_property` / `ui_template` 
group showing a single template row in deployment) where bundled templates 
weren't being pushed to OAP at all.
   
   **Root cause.** `bootSeed()` was fire-and-forget on the first `listen` 
callback — one `client.list()` attempt, and if OAP's admin port wasn't bound 
yet (common in compose / k8s rollouts where OAP starts after the BFF binds, or 
the admin module is wired lazily) the function logged one warn and returned 
`unreachable: true` with no retry. Every bundled template stayed un-pushed for 
that BFF lifetime; recovery required an operator BFF restart after OAP came up.
   
   **Fix.** Two-step boot:
   1. **`waitForOapAdminReady(deps, signal)`** — backoff loop (1s → 2s → 4s → … 
capped at 60s). Uses `client.list()` as the readiness check. Logs one warn per 
failed attempt carrying `attempt` + `nextRetryInMs` so an operator grepping 
logs sees the wait progress.
   2. **`bootSeed(deps)`** — unchanged, still absent-only via `seedMissing`. A 
fully-seeded OAP from a prior boot remains a no-op write-wise.
   
   No periodic polling once seeding completes — the admin port is only touched 
again when an operator triggers a UI sync / admin edit. The wait is cancellable 
via an `AbortController` bound to shutdown so signal-kill (k8s rolling restart, 
ctrl-c) exits the BFF cleanly even mid-backoff.
   
   ## Behaviour after this PR
   
   | Scenario | Before | After |
   |---|---|---|
   | BFF + OAP start in same rollout, OAP slow to bind admin module | one warn 
→ no templates pushed → operator restart required | warn-per-attempt → first 
successful list → seed runs once |
   | OAP admin briefly unreachable mid-startup | same as above | same as above |
   | OAP healthy at startup (warm) | seed runs immediately | seed runs 
immediately (first attempt succeeds, no extra log noise) |
   | Operator already pushed bundled templates in prior boot | seed skips 
(absent-only) | seed skips (absent-only) — no change |
   | BFF signal-killed mid-backoff | hangs on `client.list()` retries | 
`bootSeedAbort.abort()` resolves the wait, shutdown proceeds |
   
   ## Test plan
   
   - [x] `pnpm --filter bff exec tsc --noEmit` — clean.
   - [x] `pnpm --filter bff test:unit` — 80 / 80.
   - [ ] Bring up a fresh OAP + BFF together. Confirm BFF logs `OAP admin 
unreachable — retrying readiness check` with growing `nextRetryInMs` until OAP 
is up, then `OAP UI-template boot seed: complete` with non-zero `seedCount`.
   - [ ] Restart the BFF against the already-seeded OAP. Confirm `boot seed: 
complete` with `seedCount: 0` (everything already present).
   - [ ] `ctrl-c` the BFF while it's still warning about unreachable. Confirm 
clean shutdown (no hang).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to