From f8a3f16dc652577d40d32c35fd054d205ccfa3b7 Mon Sep 17 00:00:00 2001 From: yetone Date: Sun, 4 Oct 2026 11:12:15 +0800 Subject: [PATCH] =?UTF-8?q?plugin:=20the=20community's=20plugins=20are=20l?= =?UTF-8?q?ooked=20for=20updates=20every=20hour,=20not=20every=20six=20(#6?= =?UTF-8?q?81,=20ChenstarMr=20on=20v0.1.808:=20told=20TraeCN=200.1.5=20wou?= =?UTF-8?q?ld=20come=20by=20itself,=20installed=20it=20by=20hand=20eleven?= =?UTF-8?q?=20minutes=20after=20it=20was=20out)=20=E2=80=94=20KeepUpdated?= =?UTF-8?q?=20ran=20CheckUpdates=2030=20s=20after=20the=20gateway's=20magp?= =?UTF-8?q?ie=20started=20and=20then=20every=20updateEvery,=20six=20hours,?= =?UTF-8?q?=20so=20a=20fix=20published=20to=20a=20@magpie-community=20plug?= =?UTF-8?q?in=20and=20announced=20on=20its=20issue=20could=20take=20most?= =?UTF-8?q?=20of=20a=20working=20day=20to=20reach=20the=20reporter.=20upda?= =?UTF-8?q?teEvery=20is=20now=20an=20hour:=20one=20look=20at=20npm's=20met?= =?UTF-8?q?adata=20for=20the=20plugins=20installed=20(no=20download=20unle?= =?UTF-8?q?ss=20a=20community=20plugin,=20unpinned=20and=20switched=20on,?= =?UTF-8?q?=20has=20a=20newer=20version;=20someone=20else's=20still=20wait?= =?UTF-8?q?s=20for=20a=20click),=20cheap=20at=20that=20pace.=20Bun's=20own?= =?UTF-8?q?=20check=20(KeepBunUpdated,=20a=20GitHub=20release=20lookup=20w?= =?UTF-8?q?ith=20a=20two-day=20hold)=20keeps=20six=20hours=20under=20its?= =?UTF-8?q?=20own=20bunEvery.=20The=20Update=20button's=20tooltip=20on=20a?= =?UTF-8?q?=20community=20plugin=20says=20"within=20the=20hour"=20/=20?= =?UTF-8?q?=E4=B8=80=E5=B0=8F=E6=97=B6=E5=86=85=20where=20it=20said=20with?= =?UTF-8?q?in=20a=20few=20hours.=20go=20vet,=20builds=20(darwin,=20GOOS=3D?= =?UTF-8?q?linux,=20GOOS=3Dwindows)=20and=20go=20test=20-tags=20nogui=20-c?= =?UTF-8?q?ount=3D1=20./...=20under=20a=20temp=20HOME=20pass=20(TestProvid?= =?UTF-8?q?ersAnswerWhileListsComeIn,=20TestUserPath=20and=20TestClaudeSig?= =?UTF-8?q?nedOut=20failed=20once=20under=20load=20with=20four=20other=20t?= =?UTF-8?q?est=20runs=20going=20and=20pass=20on=20their=20own);=20the=20pl?= =?UTF-8?q?ugin-*.test.cjs=20GUI=20tests=20pass=20in=20webkit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/gui/assets/i18n.js | 2 +- internal/gui/assets/plugins.js | 2 +- internal/plugin/bunupdate.go | 6 +++--- internal/plugin/updates.go | 12 ++++++++---- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/internal/gui/assets/i18n.js b/internal/gui/assets/i18n.js index 3c1f03189..e560cca88 100644 --- a/internal/gui/assets/i18n.js +++ b/internal/gui/assets/i18n.js @@ -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} 有新版本", diff --git a/internal/gui/assets/plugins.js b/internal/gui/assets/plugins.js index d5a53dfdf..6ea175423 100644 --- a/internal/gui/assets/plugins.js +++ b/internal/gui/assets/plugins.js @@ -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) { diff --git a/internal/plugin/bunupdate.go b/internal/plugin/bunupdate.go index f5a718d0b..e97e62309 100644 --- a/internal/plugin/bunupdate.go +++ b/internal/plugin/bunupdate.go @@ -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) } } diff --git a/internal/plugin/updates.go b/internal/plugin/updates.go index 0a34f5a90..7e66b834d 100644 --- a/internal/plugin/updates.go +++ b/internal/plugin/updates.go @@ -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 )