dsh-unlag 1.9.47 → 1.9.48
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.
- package/index.js +9 -2
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1785,8 +1785,14 @@ function serveButton(ctx, controller, config) {
|
|
|
1785
1785
|
if (!settings.reloadPlugins) return sendJson(res, 200, { status: 'off' })
|
|
1786
1786
|
const limit = Number(process.env.DSH_UNLAG_ANSWER_MS ?? '') || RELOAD_ANSWER_MS
|
|
1787
1787
|
let timer = null
|
|
1788
|
+
let timedOut = false
|
|
1788
1789
|
const stillApplying = new Promise((resolve) => {
|
|
1789
|
-
timer = setTimeout(() =>
|
|
1790
|
+
timer = setTimeout(() => {
|
|
1791
|
+
// Only the timer's own answer means the update outlasted the page: an update that
|
|
1792
|
+
// says "applying" itself is a press that arrived during another one, not a slow one.
|
|
1793
|
+
timedOut = true
|
|
1794
|
+
resolve({ status: 'applying', warnings: [], pending: [], restartReason: null, failedEntries: [] })
|
|
1795
|
+
}, limit)
|
|
1790
1796
|
})
|
|
1791
1797
|
let answeredEarly = false
|
|
1792
1798
|
try {
|
|
@@ -1807,7 +1813,8 @@ function serveButton(ctx, controller, config) {
|
|
|
1807
1813
|
const outcome = await Promise.race([work, stillApplying])
|
|
1808
1814
|
if (outcome?.status === 'applying') {
|
|
1809
1815
|
answeredEarly = true
|
|
1810
|
-
log('the update outlasted the answer the page waits for: the press is told it is still applying')
|
|
1816
|
+
if (timedOut) log('the update outlasted the answer the page waits for: the press is told it is still applying')
|
|
1817
|
+
else log('a press arrived while an update is already applying: the press is told it is still applying')
|
|
1811
1818
|
}
|
|
1812
1819
|
sendJson(res, 200, outcome)
|
|
1813
1820
|
} finally {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-unlag",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.48",
|
|
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",
|