plugin: the community's plugins are looked for updates every hour, not every six (#681, ChenstarMr on v0.1.808: told TraeCN 0.1.5 would come by itself, installed it by hand eleven minutes after it was out) — KeepUpdated ran CheckUpdates 30 s after the gateway's magpie started and then every updateEvery, six hours, so a fix published to a @magpie-community plugin and announced on its issue could take most of a working day to reach the reporter. updateEvery is now an hour: one look at npm's metadata for the plugins installed (no download unless a community plugin, unpinned and switched on, has a newer version; someone else's still waits for a click), cheap at that pace. Bun's own check (KeepBunUpdated, a GitHub release lookup with a two-day hold) keeps six hours under its own bunEvery. The Update button's tooltip on a community plugin says "within the hour" / 一小时内 where it said within a few hours. go vet, builds (darwin, GOOS=linux, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass (TestProvidersAnswerWhileListsComeIn, TestUserPath and TestClaudeSignedOut failed once under load with four other test runs going and pass on their own); the plugin-*.test.cjs GUI tests pass in webkit.

This commit is contained in:
yetone
2026-10-04 11:12:15 +08:00
parent ed79a72927
commit f8a3f16dc6
4 changed files with 13 additions and 9 deletions
+1 -1
View File
@@ -2865,7 +2865,7 @@ const I18N = {
"npm answered with an error: {error}": "npm 返回错误:{error}",
"v{have} installed, v{v} on npm": "已安装 v{have},npm 上有 v{v}",
"v{v} is the newest on npm": "v{v} 是 npm 上的最新版本",
"magpie updates it by itself within a few hours; Update does it now": "magpie 会在几小时内自动更新它;点击“更新”立即更新",
"magpie updates it by itself within the hour; Update does it now": "magpie 会在一小时内自动更新它;点击“更新”立即更新",
"Auto-updated": "已自动更新",
"magpie updated it from v{from} to v{to} on {date}": "magpie 已于 {date} 自动将它从 v{from} 更新到 v{to}",
"An update for {name} is out": "{name} 有新版本",
+1 -1
View File
@@ -752,7 +752,7 @@
const up = el("button", "text", b === "upgrade" ? t("Updating…") : t("Update"));
up.disabled = busy.size > 0 || checking;
// the community's would come by itself: Update brings it now
if (pkg.startsWith("@magpie-community/") && !/@(?!latest$)[^@/]+$/.test(e.spec.slice(pkg.length))) up.title = t("magpie updates it by itself within a few hours; Update does it now");
if (pkg.startsWith("@magpie-community/") && !/@(?!latest$)[^@/]+$/.test(e.spec.slice(pkg.length))) up.title = t("magpie updates it by itself within the hour; Update does it now");
up.onclick = () => act(pkg, "upgrade", { spec: e.spec }, () => status(t("{name} updated to v{v}", { name: l?.name || pkg, v: e.latest }), "ok"));
val.append(up);
} else if (isGit(e.spec) && !e.off) {
+3 -3
View File
@@ -1,6 +1,6 @@
package plugin
// Bun kept up to date, as the plugins are: every few hours magpie asks
// Bun kept up to date, as the plugins are: every six hours magpie asks
// GitHub for Bun's newest release and, once it has been out two days (a
// release with a bad bug is usually followed by a fix within them),
// downloads it, checks its checksum, tries it and switches the plugin
@@ -275,7 +275,7 @@ func pruneBuns(s bunState) {
}
// KeepBunUpdated looks for a newer Bun a little after magpie starts, then
// every updateEvery, while there are plugins to run on it.
// every bunEvery, while there are plugins to run on it.
func KeepBunUpdated(ctx context.Context) {
t := time.NewTimer(2 * time.Minute)
defer t.Stop()
@@ -292,6 +292,6 @@ func KeepBunUpdated(ctx context.Context) {
}
cancel()
}
t.Reset(updateEvery)
t.Reset(bunEvery)
}
}
+8 -4
View File
@@ -2,8 +2,7 @@ package plugin
// Plugin updates, as magpie keeps itself up to date: the community's
// plugins (@magpie-community/*, the ones the built-in subscriptions move
// onto) update by themselves, a little after magpie starts and every few
// hours; anyone else's new version waits for the reader, who sees a dot
// onto) update by themselves, a little after magpie starts and every hour; anyone else's new version waits for the reader, who sees a dot
// on Plugins and updates it with a click. A plugin pinned to a version
// stays on it. Updating never cuts a reply streaming through a plugin:
// the host it runs on finishes it (see Restart).
@@ -55,8 +54,13 @@ type Updated struct {
}
const (
// updateEvery is how often magpie looks for plugin updates
updateEvery = 6 * time.Hour
// updateEvery is how often magpie looks for plugin updates: a fix to a
// community plugin reaches its users within the hour (one look at npm's
// metadata for the plugins installed; six hours left someone told of a
// fix installing it by hand, #681)
updateEvery = time.Hour
// bunEvery is how often magpie looks for a newer Bun
bunEvery = 6 * time.Hour
// keepUpdated is how many updates magpie remembers making
keepUpdated = 20
)