dsh-unlag 1.9.25 → 1.9.26

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 (3) hide show
  1. package/client.js +1 -0
  2. package/index.js +14 -1
  3. package/package.json +1 -1
package/client.js CHANGED
@@ -245,6 +245,7 @@ window.__ModuleLoader__.load({
245
245
  network: 'script', // ui-copy-ignore
246
246
  parse: 'parse', // ui-copy-ignore
247
247
  register: 'plugin', // ui-copy-ignore
248
+ slow: 'script', // ui-copy-ignore
248
249
  dependencies: 'covers',
249
250
  list: 'list', // ui-copy-ignore
250
251
  };
package/index.js CHANGED
@@ -92,6 +92,12 @@ const MAX_STARTUP_ROW_CHARS = 4096
92
92
  * is work the request itself must not be able to grow without bound.
93
93
  */
94
94
  const MAX_BUNDLE_IDS = 128
95
+ /**
96
+ * How long one startup check may spend reading the list. Each address is bounded on its own, but a
97
+ * list of them is not: dozens of slow addresses would otherwise hold a press past the moment the
98
+ * page gives up waiting, and the person would see a button that did nothing.
99
+ */
100
+ const MAX_VERIFY_MS = 9000
95
101
  const MIN_INTERVAL_MS = 1500
96
102
  /** The route the app publishes client bundles under; the same key the module table registers. */
97
103
  const BUNDLE_ROUTE = '/plugins'
@@ -1417,7 +1423,7 @@ function parseAsScript(body, name) {
1417
1423
  * @param fetchBody reads one script address and answers a response-like, or null when it cannot.
1418
1424
  * @param rows the startup script addresses, as the next document would request them.
1419
1425
  */
1420
- export async function verifyStartupRows(graph, fetchBody, rows) {
1426
+ export async function verifyStartupRows(graph, fetchBody, rows, budgetMs = MAX_VERIFY_MS) {
1421
1427
  const entries = new Map(
1422
1428
  (Array.isArray(graph?.entries) ? graph.entries : [])
1423
1429
  .filter((row) => typeof row?.id === 'string' && row.id !== '')
@@ -1447,7 +1453,11 @@ export async function verifyStartupRows(graph, fetchBody, rows) {
1447
1453
  const leftOut = new Set()
1448
1454
  const listed = new Set()
1449
1455
  const bodies = []
1456
+ const began = Date.now()
1450
1457
  for (const item of wanted) {
1458
+ if (Date.now() - began > budgetMs) {
1459
+ return { status: 'blocked', reason: 'slow', detail: 'the startup list took longer than this check waits' }
1460
+ }
1451
1461
  for (const id of item.ids) if (served.has(id)) listed.add(id)
1452
1462
  for (const id of item.ids) if (!served.has(id)) leftOut.add(id)
1453
1463
  let response = null
@@ -1595,6 +1605,9 @@ function serveButton(ctx, controller, config) {
1595
1605
  } catch (error) {
1596
1606
  verdict = { status: 'blocked', reason: 'list', detail: String(error?.message ?? error) }
1597
1607
  }
1608
+ if (verdict?.status !== 'ok') {
1609
+ log(`a startup check refused the page: ${String(verdict?.reason ?? 'list')} (${String(verdict?.detail ?? 'no detail')})`)
1610
+ }
1598
1611
  if (Array.isArray(verdict?.leftOut) && verdict.leftOut.length > 0) {
1599
1612
  log(`a startup row names a plugin this app no longer serves: ${verdict.leftOut.join(', ')}; the page comes up without it`)
1600
1613
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-unlag",
3
- "version": "1.9.25",
3
+ "version": "1.9.26",
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",