querysub 0.261.0 → 0.263.0
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/package.json
CHANGED
|
@@ -32,7 +32,7 @@ export function startEdgeNotifier() {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
let watchingClientNodes = new Set<string>();
|
|
35
|
-
const notifyClients = throttleFunction(timeInMinute
|
|
35
|
+
const notifyClients = throttleFunction(timeInMinute, async function notifyClients(liveHash: string, refreshThresholdTime: number) {
|
|
36
36
|
// Wait, so the servers have time to load the new code. We tell the servers to preload but apparently there's some kind of lag, So we'll just delay here.
|
|
37
37
|
console.log(blue(`Waiting 30 seconds before notifying clients about liveHash ${liveHash}`));
|
|
38
38
|
await delay(30 * 1000);
|
|
@@ -67,21 +67,30 @@ function onLiveHashChange(liveHash: string, refreshThresholdTime: number) {
|
|
|
67
67
|
// Start notification loop
|
|
68
68
|
void (async () => {
|
|
69
69
|
// Show notifications at intervals
|
|
70
|
-
for (let i = 0; i < notifyIntervals.length; i++) {
|
|
70
|
+
for (let i = 0; i < notifyIntervals.length - 1; i++) {
|
|
71
71
|
// Don't show if a newer notification is active
|
|
72
72
|
if (curHash !== liveHash) return;
|
|
73
73
|
|
|
74
74
|
let waitDuration = (notifyIntervals[i + 1] - notifyIntervals[i]) * refreshThresholdTime;
|
|
75
|
-
|
|
75
|
+
// If the duration is short, and it's not the last one, skip it
|
|
76
|
+
if (i < notifyIntervals.length - 2 && waitDuration <= 30 * 1000) continue;
|
|
76
77
|
|
|
77
78
|
// Update the URL override for manual refreshes
|
|
78
79
|
Querysub.localCommit(() => {
|
|
79
80
|
liveHashOverrideURL.value = { liveHash, time: Date.now() };
|
|
80
81
|
});
|
|
81
82
|
if (!skipFirst) {
|
|
83
|
+
if (currentNotification) {
|
|
84
|
+
currentNotification.close();
|
|
85
|
+
currentNotification = null;
|
|
86
|
+
}
|
|
82
87
|
// Show notification modal
|
|
83
|
-
|
|
88
|
+
let nextNotification = {
|
|
84
89
|
close: showModal({
|
|
90
|
+
onClose: () => {
|
|
91
|
+
if (currentNotification !== nextNotification) return;
|
|
92
|
+
currentNotification = null;
|
|
93
|
+
},
|
|
85
94
|
content: (
|
|
86
95
|
<div
|
|
87
96
|
title={`Live Hash: ${liveHash}, prev hash: ${prevHash}`}
|
|
@@ -92,11 +101,14 @@ function onLiveHashChange(liveHash: string, refreshThresholdTime: number) {
|
|
|
92
101
|
.bottom(10)
|
|
93
102
|
.right(10)
|
|
94
103
|
.zIndex(1000)
|
|
104
|
+
+ " keepModalsOpen"
|
|
95
105
|
}
|
|
96
106
|
>
|
|
97
107
|
<div className={css.vbox(10).maxWidth(250)}>
|
|
98
108
|
<h3 className={css.margin(0)}>Server Update Available</h3>
|
|
99
109
|
<div>The server has been updated. Please refresh the page to ensure you don't experience incompatibility issues.</div>
|
|
110
|
+
{i !== notifyIntervals.length - 2 && <div>This notification will be shown again in {formatTime(waitDuration)}</div>}
|
|
111
|
+
{i === notifyIntervals.length - 2 && <div>The page will automatically refresh in {formatTime(waitDuration)}</div>}
|
|
100
112
|
</div>
|
|
101
113
|
<div className={css.hbox(10).justifyContent("flex-end")}>
|
|
102
114
|
<button
|
|
@@ -126,6 +138,7 @@ function onLiveHashChange(liveHash: string, refreshThresholdTime: number) {
|
|
|
126
138
|
)
|
|
127
139
|
}).close
|
|
128
140
|
};
|
|
141
|
+
currentNotification = nextNotification;
|
|
129
142
|
}
|
|
130
143
|
skipFirst = false;
|
|
131
144
|
|
|
@@ -133,9 +146,6 @@ function onLiveHashChange(liveHash: string, refreshThresholdTime: number) {
|
|
|
133
146
|
await delay(waitDuration);
|
|
134
147
|
}
|
|
135
148
|
|
|
136
|
-
console.log(red(`Force refresh after 30 seconds`));
|
|
137
|
-
await delay(30 * 1000);
|
|
138
|
-
|
|
139
149
|
// Only force refresh if this is still the current notification
|
|
140
150
|
if (curHash === liveHash) {
|
|
141
151
|
window.location.reload();
|
|
@@ -268,6 +268,7 @@ export class DeployPage extends qreact.Component {
|
|
|
268
268
|
<div className={css.hbox(10)}>
|
|
269
269
|
<UpdateButtons services={[]} />
|
|
270
270
|
<button
|
|
271
|
+
disabled={controller.isAnyLoading()}
|
|
271
272
|
className={buttonStyle.alignSelf("stretch").center.hsl(240, 70, 50).colorhsl(0, 0, 100)
|
|
272
273
|
+ (anyUncommitted && css.opacity(0.5))
|
|
273
274
|
+ (this.state.isDeploying && css.opacity(0.7))
|
|
@@ -2,6 +2,7 @@ import { css } from "typesafecss";
|
|
|
2
2
|
import { qreact } from "../../4-dom/qreact";
|
|
3
3
|
import { formatDateJSX } from "../../misc/formatJSX";
|
|
4
4
|
import { formatTime } from "socket-function/src/formatting/format";
|
|
5
|
+
import { Querysub } from "../../4-querysub/QuerysubController";
|
|
5
6
|
|
|
6
7
|
module.hotreload = true;
|
|
7
8
|
|
|
@@ -36,7 +37,7 @@ export function DeployProgressView({ stages, isDeploying, deploySuccess, deployS
|
|
|
36
37
|
}) {
|
|
37
38
|
if (!isDeploying && !deploySuccess) return null;
|
|
38
39
|
|
|
39
|
-
const now =
|
|
40
|
+
const now = Querysub.timeDelayed(1000);
|
|
40
41
|
const elapsed = (deployEndTime || now) - (deployStartTime || now);
|
|
41
42
|
|
|
42
43
|
// Separate pending and finished stages
|