dsh-unlag 1.9.31 → 1.9.32

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 +20 -2
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1678,9 +1678,27 @@ function serveButton(ctx, controller, config) {
1678
1678
  const stillApplying = new Promise((resolve) => {
1679
1679
  timer = setTimeout(() => resolve({ status: 'applying', warnings: [], pending: [], restartReason: null, failedEntries: [] }), limit)
1680
1680
  })
1681
+ let answeredEarly = false
1681
1682
  try {
1682
- const outcome = await Promise.race([controller.reloadNow(), stillApplying])
1683
- if (outcome?.status === 'applying') log('the update outlasted the answer the page waits for: the press is told it is still applying')
1683
+ const work = controller.reloadNow()
1684
+ /**
1685
+ * The answer the page waits for is bounded, but the update is not. Whatever the update
1686
+ * did after the page was told it is still applying is written down here: a replacement
1687
+ * that failed a moment later must not look like one that succeeded.
1688
+ */
1689
+ work.then(
1690
+ (late) => {
1691
+ if (answeredEarly) log(`the update finished after the page was told it is still applying: ${String(late?.status ?? 'no status')}`)
1692
+ },
1693
+ (error) => {
1694
+ if (answeredEarly) log(`the update failed after the page was told it is still applying: ${error?.message ?? error}`)
1695
+ },
1696
+ )
1697
+ const outcome = await Promise.race([work, stillApplying])
1698
+ if (outcome?.status === 'applying') {
1699
+ answeredEarly = true
1700
+ log('the update outlasted the answer the page waits for: the press is told it is still applying')
1701
+ }
1684
1702
  sendJson(res, 200, outcome)
1685
1703
  } finally {
1686
1704
  if (timer !== null) clearTimeout(timer)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-unlag",
3
- "version": "1.9.31",
3
+ "version": "1.9.32",
4
4
  "type": "module",
5
5
  "description": "A press applies plugin edits right away and brings a laggy interface back; automatic reloading stays off unless you turn it on, so the press is the only trigger, and nothing restarts.",
6
6
  "license": "MIT",