e4e9eb0928becfa4e48484dde85ef5032671d582
2
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
75ab21af4d |
plugin: a test binary takes no Bun from PATH (#6761, #6764)
TestRemoveListedAccountLeavesHiddenNamesake went red in every whole-package run of internal/provider since |
||
|
|
30de93e9e9 |
plugins: a request whose Bun is still downloading fails at once and fails over (#6735)
hixonchan (kyrierekkok123-del on GitHub): with magpie's own Bun missing and its download stalled, every plugin-served request hung with zero bytes, nothing in the log, no timeout and no failover, and `magpie plugin` hung too. The host's lock (hostMu) was held across Bun's download, which had no bound on the whole, so every caller waited on it whatever its context said. Now: - Bun is downloaded in the background, once at a time per Bun (bunready.go). The host waits for it up to 10s from when it began (bunReadyWait); then each call ends with BunNotReadyError, "Bun runtime not ready: downloading Bun 1.4.2 (12s so far)…" or "… failed: <why>", logged, and the gateway goes on to the group's next member. - A failed download is said at once for a minute, then tried again; installs (plugin.Bun) still wait as long as their context lets. - hostMu is a channel lock that a caller's context can end (LockCtx); the gateway's TryLock polling loops use it. - When the download fails, a Bun on PATH or in ~/.bun/bin is taken if magpie would run it itself: at least BunVersion, not set aside, passing the try a new release gets. It is copied in as magpie-bun (#1048). magpie's checksummed build stays first; the user's own Bun is better than no plugins, and it is what the reporter fell back on by hand. - Each stage is logged: download started, failed after N, downloaded in N, the PATH Bun taken or refused and why. - Every route through the host gets it: fetch, loader options, sign-in, the plugin listing (CLI and GUI). `magpie plugin` prints the list and the not-ready reason within ~10s. Self-restart and env (the reporter's point 4): Reexec, RelaunchBinary and StartBeside pass os.Environ; only the Mac's bundle relaunch (open -n) starts with LaunchServices' env. Filed as #6757, not changed here. With this change MAGPIE_BUN isn't needed. Tests (each red on the old code with a shim for the new test hooks, logs kept): - TestHostWhileBunDownloadStalls: old code, "a caller whose context ended still waits on the stalled Bun download"; now not-ready at 2s, the 100ms caller returns, then the host starts on the download, asked once. - TestHostAfterBunDownloadFailedSaysWhy: old code, a plain 500 error, not BunNotReady; now the 500 is said twice with one ask, Bun() retries. - TestBunOnPathAfterDownloadFailed: old code failed; now 1.4.2 taken, 1.0.0 refused. - TestPluginWhoseBunIsNotReadyFailsOver (gateway, real Handler): old code, "group/mixed still unanswered after 20s"; now 200 from the next member in 0.84s, and the plugin's own model answers 502 "Bun runtime not ready" after ~300ms. Run on mote at |