dsh-aupdate 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +10 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1549,7 +1549,11 @@ function settingsSnapshot(config, ctxRef) {
1549
1549
  history: readHistory().slice(0, 40),
1550
1550
  historyPath: historyPath(),
1551
1551
  // 下一轮什么时候跑:设置页把它直接显示出来,用户不用自己推算。
1552
- nextInMinutes: nextDelayMinutes(settings, new Date()),
1552
+ // 调度器已经把「这一轮真实等多久」记在 pendingMinutes 上,优先用它;
1553
+ // 取不到(比如定时器还没排上)才退回按当前规则现算。
1554
+ nextInMinutes: typeof ctxRef?.pendingMinutes === 'number'
1555
+ ? ctxRef.pendingMinutes
1556
+ : nextDelayMinutes(settings, new Date()),
1553
1557
  // 被抑制的 pkg@版本:让人看得见「为什么这个包不更新了」。
1554
1558
  failures: readFailures().slice(0, 20).map((row) => {
1555
1559
  const at = Date.parse(String(row.at ?? ''))
@@ -1766,6 +1770,7 @@ export function apply(ctx, config) {
1766
1770
  let firstPending = true
1767
1771
 
1768
1772
  const clearScheduled = () => {
1773
+ ctxRef.pendingMinutes = null
1769
1774
  if (scheduled === null) return
1770
1775
  try {
1771
1776
  clearTimeout(scheduled)
@@ -1784,6 +1789,10 @@ export function apply(ctx, config) {
1784
1789
  // 启动后第一次仍然只看 firstDelayMinutes,之后按当前调度模式算。
1785
1790
  const minutes = firstPending && live.checkOnStart ? live.firstDelayMinutes : nextDelayMinutes(live, new Date())
1786
1791
  firstPending = false
1792
+ // 记下这一轮真实的等待时长,设置页按它显示「下一轮」。
1793
+ // 直接拿 nextDelayMinutes 算会漏掉启动后那次短期检查:明明 5 分钟后就要跑,
1794
+ // 面板却显示 1440 分钟,看的人只会以为「启动后根本不查」,于是手动点一次。
1795
+ ctxRef.pendingMinutes = minutes
1787
1796
  const handle = setTimeout(() => {
1788
1797
  scheduled = null
1789
1798
  runSafely('update')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-aupdate",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "type": "module",
5
5
  "description": "定时检查 DSH 插件更新,串行安装后就地生效,不重启;支持多种调度节奏、失败抑制、按包回滚,并在动手前留快照、忙时自动让开。",
6
6
  "license": "MIT",