querysub 0.298.0 → 0.300.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
|
@@ -34,9 +34,6 @@ export function startEdgeNotifier() {
|
|
|
34
34
|
let { watchOnRollingUpdate } = await import("../deployManager/machineController");
|
|
35
35
|
watchOnRollingUpdate({
|
|
36
36
|
callback: (time) => {
|
|
37
|
-
let duration = Date.now() - time;
|
|
38
|
-
// Refresh 10% earlier, as we don't want clients to refresh RIGHT when the server shutsdown...
|
|
39
|
-
time = Date.now() + duration * 0.9;
|
|
40
37
|
void notifyClients(`forcedupdate-at-${time}`, time);
|
|
41
38
|
}
|
|
42
39
|
});
|
|
@@ -45,9 +42,6 @@ export function startEdgeNotifier() {
|
|
|
45
42
|
|
|
46
43
|
let watchingClientNodes = new Set<string>();
|
|
47
44
|
const notifyClients = throttleFunction(timeInMinute, async function notifyClients(liveHash: string, refreshThresholdTime: number) {
|
|
48
|
-
// 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.
|
|
49
|
-
console.log(blue(`Waiting 30 seconds before notifying clients about liveHash ${liveHash}`));
|
|
50
|
-
await delay(30 * 1000);
|
|
51
45
|
console.log(blue(`Notifying ${watchingClientNodes.size} clients about liveHash ${liveHash}`));
|
|
52
46
|
await Promise.allSettled(Array.from(watchingClientNodes).map(async clientNodeId => {
|
|
53
47
|
try {
|
|
@@ -63,7 +57,7 @@ const notifyClients = throttleFunction(timeInMinute, async function notifyClient
|
|
|
63
57
|
let currentNotification: { close: () => void } | null = null;
|
|
64
58
|
let curHash = "";
|
|
65
59
|
function onLiveHashChange(liveHash: string, refreshThresholdTime: number) {
|
|
66
|
-
console.log(blue(`
|
|
60
|
+
console.log(blue(`Received client liveHash ${liveHash}, prev hash: ${curHash}`));
|
|
67
61
|
if (liveHash === curHash) return;
|
|
68
62
|
let prevHash = curHash;
|
|
69
63
|
// Don't notify the user right away. Hopefully they refresh naturally, and we never have to notify them at all!
|
|
@@ -131,9 +125,11 @@ function onLiveHashChange(liveHash: string, refreshThresholdTime: number) {
|
|
|
131
125
|
<button
|
|
132
126
|
className={css.pad(8, 16).hsl(200, 50, 50).color("white").pointer}
|
|
133
127
|
onClick={(e) => {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
128
|
+
if (!liveHash.startsWith("forced")) {
|
|
129
|
+
Querysub.localCommit(() => {
|
|
130
|
+
liveHashOverrideURL.value = { liveHash, time: Date.now() };
|
|
131
|
+
});
|
|
132
|
+
}
|
|
137
133
|
window.location.reload();
|
|
138
134
|
}}
|
|
139
135
|
>
|