clavarium 0.2.531-next.1 → 0.2.532-next.1
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/deploy/multipass-refresh.mjs +9 -11
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
|
@@ -56,14 +56,14 @@ export async function multipassTurn({ run, mode, inWindow, busy, state, save, lo
|
|
|
56
56
|
|
|
57
57
|
const answers = async () => { for (let i = 0; i < BACK_TRIES; i += 1) { if ((await sh([multipass, 'list', '--format', 'json'], 30_000)).code === 0) return true; await sleep(BACK_EVERY_MS); } return false; };
|
|
58
58
|
/* MUTE AFTER ITS UPDATE (25-11, on a real server: four machines started, then its daemon died and stayed mute for
|
|
59
|
-
three hours). Not waited for: its daemon restarted, then stopped and started for sure
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
three hours). Not waited for: its daemon restarted, then stopped and started for sure; each step said. Its
|
|
60
|
+
previous version is never put back by itself (its owner's choice: it may not read what the new one wrote).
|
|
61
|
+
Still mute: the server's watch tries again every 10 minutes and says so. True once it answers. */
|
|
62
|
+
const rescue = async () => {
|
|
62
63
|
if (await answers()) return true;
|
|
63
64
|
const steps = [
|
|
64
65
|
['its daemon is restarted', ['snap', 'restart', 'multipass.multipassd']],
|
|
65
66
|
['its daemon is stopped and started for sure', null],
|
|
66
|
-
...(updated ? [['its previous version is put back', ['snap', 'revert', 'multipass']]] : []),
|
|
67
67
|
];
|
|
68
68
|
for (const [what, argv] of steps) {
|
|
69
69
|
log(`multipass: it does not answer: ${what}`);
|
|
@@ -74,8 +74,8 @@ export async function multipassTurn({ run, mode, inWindow, busy, state, save, lo
|
|
|
74
74
|
return false;
|
|
75
75
|
};
|
|
76
76
|
/* Started again; what could not be stays written down, for the next turn. */
|
|
77
|
-
const back = async (names
|
|
78
|
-
if (!(await rescue(
|
|
77
|
+
const back = async (names) => {
|
|
78
|
+
if (!(await rescue())) { log('multipass: it still does not answer: its machines are started at the next turn; the server\'s watch keeps trying'); return names; }
|
|
79
79
|
const left = [];
|
|
80
80
|
for (const name of names) {
|
|
81
81
|
let r = await sh([multipass, 'start', name], MACHINE_MS);
|
|
@@ -83,7 +83,7 @@ export async function multipassTurn({ run, mode, inWindow, busy, state, save, lo
|
|
|
83
83
|
if (r.code !== 0) {
|
|
84
84
|
/* It died while they were started (25-11): rescued, then this one tried once more. */
|
|
85
85
|
const mute = (await sh([multipass, 'list', '--format', 'json'], 30_000)).code !== 0;
|
|
86
|
-
if (mute && await rescue(
|
|
86
|
+
if (mute && await rescue()) r = await sh([multipass, 'start', name], MACHINE_MS);
|
|
87
87
|
if (r.code !== 0) { left.push(name); log(`multipass: ${name} could not be started again: ${first(r)}`); }
|
|
88
88
|
}
|
|
89
89
|
}
|
|
@@ -92,9 +92,7 @@ export async function multipassTurn({ run, mode, inWindow, busy, state, save, lo
|
|
|
92
92
|
|
|
93
93
|
const pending = state().multipassRefresh?.machines ?? [];
|
|
94
94
|
if (pending.length) {
|
|
95
|
-
|
|
96
|
-
const lately = Date.parse(state().multipassRefresh?.triedAt ?? '');
|
|
97
|
-
const left = await back(pending, { updated: Number.isFinite(lately) && now() - lately < 86_400_000 });
|
|
95
|
+
const left = await back(pending);
|
|
98
96
|
save({ multipassRefresh: { ...state().multipassRefresh, machines: left } });
|
|
99
97
|
if (left.length) return `${left.length} machine(s) still to start again`;
|
|
100
98
|
log('multipass: the machines of the last update are running again');
|
|
@@ -128,7 +126,7 @@ export async function multipassTurn({ run, mode, inWindow, busy, state, save, lo
|
|
|
128
126
|
/* --ignore-running: a client of Multipass still open (a terminal, a command) would make snap refuse (seen on a real machine); its machine is asleep. */
|
|
129
127
|
const done = await sh(['snap', 'refresh', 'multipass', '--ignore-running'], REFRESH_MS);
|
|
130
128
|
log(done.code === 0 ? 'multipass: updated' : `multipass: its update failed: ${first(done)}`);
|
|
131
|
-
const left = await back(running
|
|
129
|
+
const left = await back(running);
|
|
132
130
|
save({ multipassRefresh: { ...state().multipassRefresh, machines: left } });
|
|
133
131
|
log(left.length ? `multipass: ${left.length} machine(s) to start again at the next turn` : 'multipass: its machines are running again');
|
|
134
132
|
return done.code === 0 ? 'updated' : 'update failed';
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clavarium",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.532-next.1",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "clavarium",
|
|
9
|
-
"version": "0.2.
|
|
9
|
+
"version": "0.2.532-next.1",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|