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.
@@ -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, then -- right after its
60
- own update -- snap's previous revision of it put back. Each step said. True once it answers. */
61
- const rescue = async ({ updated }) => {
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, { updated = false } = {}) => {
78
- if (!(await rescue({ updated }))) { log('multipass: it still does not answer: its machines are started at the next turn; the server\'s watch keeps trying'); return names; }
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({ updated })) r = await sh([multipass, 'start', name], MACHINE_MS);
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
- /* Its own update lately (a day): putting its previous version back is still one of the ways. */
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, { updated: done.code === 0 });
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';
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "clavarium",
3
- "version": "0.2.531-next.1",
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.531-next.1",
9
+ "version": "0.2.532-next.1",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@xterm/addon-fit": "^0.11.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clavarium",
3
- "version": "0.2.531-next.1",
3
+ "version": "0.2.532-next.1",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "description": "A conversation is a VM with a terminal in it. Everything else is a folder.",