next-issue 17.2.10 → 17.2.11
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/dist/cli/start.mjs +1 -2
- package/dist/cli/switch-run.mjs +8 -1
- package/package.json +1 -1
package/dist/cli/start.mjs
CHANGED
|
@@ -3,12 +3,11 @@ import { givenStartFlags } from '../shared/args.mjs';
|
|
|
3
3
|
import { isNewer } from '../shared/protocol.mjs';
|
|
4
4
|
import { packageVersion } from '../shared/version.mjs';
|
|
5
5
|
import { ANSWER_TIMEOUT_MS, CLOSED, going, reachWorker, startedRun, } from '../shared/worker-client.mjs';
|
|
6
|
-
import { statusText, switched } from './switch-run.mjs';
|
|
6
|
+
import { SILENT, statusText, switched } from './switch-run.mjs';
|
|
7
7
|
const REFUSED_GOING = [
|
|
8
8
|
'a run is going in this repository already',
|
|
9
9
|
'the worker is restarting, try again soon',
|
|
10
10
|
];
|
|
11
|
-
const SILENT = 'the next-issue worker did not answer';
|
|
12
11
|
const STARTED = 'the run started in the worker; follow it with `npx -y next-issue@latest logs` and stop it with `npx -y next-issue@latest stop`\n';
|
|
13
12
|
export async function startInWorker(root, argv) {
|
|
14
13
|
const version = await packageVersion();
|
package/dist/cli/switch-run.mjs
CHANGED
|
@@ -4,6 +4,7 @@ import { packageVersion } from '../shared/version.mjs';
|
|
|
4
4
|
import { ANSWER_TIMEOUT_MS, CLOSED, findWorker, going, } from '../shared/worker-client.mjs';
|
|
5
5
|
const FIELDS = { watch: 'watching', hunt: 'hunting' };
|
|
6
6
|
const NO_RUN = 'no run is going in this repository\n';
|
|
7
|
+
export const SILENT = 'the next-issue worker did not answer';
|
|
7
8
|
function onOffText(on) {
|
|
8
9
|
return on === true ? 'on' : 'off';
|
|
9
10
|
}
|
|
@@ -36,19 +37,25 @@ export function switched(connection, root, name, on) {
|
|
|
36
37
|
const id = randomUUID();
|
|
37
38
|
let sent = false;
|
|
38
39
|
return new Promise((resolve, reject) => {
|
|
40
|
+
const timer = setTimeout(() => reject(new Error(SILENT)), ANSWER_TIMEOUT_MS);
|
|
39
41
|
connection.listen((message) => {
|
|
40
42
|
if (!sent) {
|
|
41
43
|
return;
|
|
42
44
|
}
|
|
43
45
|
const progress = message.type === 'runs' ? message.runs[root] : undefined;
|
|
44
46
|
if (progress !== undefined && progress[FIELDS[name]] === on) {
|
|
47
|
+
clearTimeout(timer);
|
|
45
48
|
resolve(progress);
|
|
46
49
|
}
|
|
47
50
|
else if (message.type === 'error' && message.id === id) {
|
|
51
|
+
clearTimeout(timer);
|
|
48
52
|
reject(new Error(message.message));
|
|
49
53
|
}
|
|
50
54
|
});
|
|
51
|
-
void connection.closed.then(() =>
|
|
55
|
+
void connection.closed.then(() => {
|
|
56
|
+
clearTimeout(timer);
|
|
57
|
+
reject(new Error(CLOSED));
|
|
58
|
+
});
|
|
52
59
|
connection.send({ type: name, root, on, id });
|
|
53
60
|
sent = true;
|
|
54
61
|
});
|