dsh-unlag 1.9.5 → 1.9.7

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 +16 -3
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -477,7 +477,9 @@ function pluginReloader(ctx, config) {
477
477
  return
478
478
  }
479
479
  if (busy()) log('reloading while turns are still running; they keep running')
480
- void reloadNow(true).catch(() => {})
480
+ // A rejection here would otherwise vanish: the press already answered, so the log is the only
481
+ // place that can say the update stopped.
482
+ void reloadNow(true).catch((error) => log(`a queued reload could not finish: ${error?.message ?? error}`))
481
483
  }
482
484
  queued = unrefTimer(setTimeout(tick, 1000))
483
485
  return 'queued'
@@ -692,7 +694,10 @@ function buttonAllowed(req) {
692
694
  }
693
695
  }
694
696
  return true
695
- } catch {
697
+ } catch (error) {
698
+ // The check itself failing is not the same as a refusal, and a silent one hides a bug behind
699
+ // a working-looking 403: leave the real reason in the log.
700
+ log(`cannot check where a press came from: ${error?.message ?? error}`)
696
701
  return false
697
702
  }
698
703
  }
@@ -1084,7 +1089,15 @@ function serveBundlesAtCurrentRevision(ctx) {
1084
1089
  */
1085
1090
  const wrapped = async (req, res) => {
1086
1091
  const originalUrl = String(req?.url ?? '')
1087
- const retargeted = retargetRevision(originalUrl, entryRevisionFor(clientModules.graph(), originalUrl))
1092
+ // Reading the table can throw while the plugin set is being swapped. This runs inside an async
1093
+ // route handler, where a rejection is an unhandled one and takes the whole app with it, so the
1094
+ // failure has to end here: answer the request as the table left it and say why in the log.
1095
+ let retargeted = null
1096
+ try {
1097
+ retargeted = retargetRevision(originalUrl, entryRevisionFor(clientModules.graph(), originalUrl))
1098
+ } catch (error) {
1099
+ log(`cannot read the plugin table for a bundle request: ${error?.message ?? error}`)
1100
+ }
1088
1101
  const realWriteHead = res.writeHead
1089
1102
  const realEnd = res.end
1090
1103
  const ask = async (url) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-unlag",
3
- "version": "1.9.5",
3
+ "version": "1.9.7",
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",