querysub 0.228.0 → 0.230.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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "querysub",
3
- "version": "0.228.0",
3
+ "version": "0.230.0",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "note1": "note on node-forge fork, see https://github.com/digitalbazaar/forge/issues/744 for details",
@@ -299,19 +299,22 @@ type ServiceConfig = ${serviceConfigType}
299
299
  )}
300
300
  </div>
301
301
  {hasError && (
302
- <div className={css.pad2(8, 4)}>
302
+ <div
303
+ className={css.pad2(8, 4).button}
304
+ onClick={(e) => {
305
+ e.stopPropagation();
306
+ const key = `${machineId}-${selectedServiceId || ""}`;
307
+ const current = this.state.expandedErrors[key];
308
+ if (current) {
309
+ current.expanded = !current.expanded;
310
+ } else {
311
+ this.state.expandedErrors[key] = { expanded: true };
312
+ }
313
+ }}
314
+ >
303
315
  <div
304
- className={css.button.pad2(4, 8).bord2(0, 0, 10).hsl(0, 0, 80)}
305
- onClick={(e) => {
306
- e.stopPropagation();
307
- const key = `${machineId}-${selectedServiceId || ""}`;
308
- const current = this.state.expandedErrors[key];
309
- if (current) {
310
- current.expanded = !current.expanded;
311
- } else {
312
- this.state.expandedErrors[key] = { expanded: true };
313
- }
314
- }}>
316
+ className={css.pad2(4, 8).bord2(0, 0, 10).hsl(0, 0, 80)}
317
+ >
315
318
  {this.state.expandedErrors[`${machineId}-${selectedServiceId || ""}`]?.expanded ? "Hide Error ▲" : "Show Error ▼"}
316
319
  </div>
317
320
  {serviceInfo?.errorFromLastRun && this.state.expandedErrors[`${machineId}-${selectedServiceId || ""}`]?.expanded && (
@@ -466,6 +469,7 @@ type ServiceConfig = ${serviceConfigType}
466
469
  theme: "vs-dark",
467
470
  automaticLayout: true,
468
471
  minimap: { enabled: false },
472
+ wordWrap: "on",
469
473
  });
470
474
 
471
475
  // Listen for changes
@@ -170,10 +170,38 @@ const runScreenCommand = measureWrap(async function runScreenCommand(config: {
170
170
  await runPromise(`${prefix}tmux new -s ${screenName} -d`);
171
171
  } catch { }
172
172
  await runPromise(`${prefix}tmux send-keys -t ${screenName} 'echo "Updating running command at ${new Date().toISOString()}"' Enter`);
173
- // Send ctrl+c to kill any running command
174
173
  await runPromise(`${prefix}tmux send-keys -t ${screenName} 'C-c' Enter`);
174
+ await delay(1000);
175
+
176
+ let screens = await getScreenState();
177
+ let screen = screens.find(x => x.screenName === screenName);
178
+ let pid = screen?.pid;
179
+ if (pid && await isScreenRunningProcess(pid)) {
180
+ // It doesn't want to die. Wait longer, but it it just won't die, kill the screen
181
+ console.warn(`Screen ${screenName} is not dying, giving it another 30 seconds`);
182
+ await delay(timeInSecond * 30);
183
+ if (pid && await isScreenRunningProcess(pid)) {
184
+ console.warn(`Screen ${screenName} is still running, killing it forcefully`);
185
+ await killScreen({ screenName });
186
+ if (pid && await isScreenRunningProcess(pid)) {
187
+ console.error(`I don't know what happened. The screen won't die. We can't do much else, I guess we'll just ignore it...`);
188
+ } else {
189
+ // Nested, to create the screen again.
190
+ await runScreenCommand({
191
+ screenName,
192
+ command: config.command,
193
+ folder: config.folder,
194
+ });
195
+ return;
196
+ }
197
+ }
198
+ }
175
199
  await runPromise(`${prefix}tmux send-keys -t ${screenName} 'cd ${config.folder}' Enter`);
176
- await runPromise(`${prefix}tmux send-keys -t ${screenName} '${config.command}' Enter`);
200
+ let command = `#!/bin/bash
201
+ ${config.command}
202
+ `;
203
+ await fs.promises.writeFile(config.folder + "../command.sh", command);
204
+ await runPromise(`${prefix}tmux send-keys -t ${screenName} 'bash command.sh' Enter`);
177
205
  });
178
206
  const killScreen = measureWrap(async function killScreen(config: {
179
207
  screenName: string;
@@ -7,21 +7,22 @@
7
7
  - So we might need to use ctrl+c multiple times, and callback to kill the service?
8
8
 
9
9
 
10
- 4) Default the repoUrl and gitRef to the url and ref the server is running
11
- - Accessed when we click create service
10
+ 7.1) Better infinite poll support in shutdown
11
+ - Stop all loops
12
+ - If any are running, wait (with timeout, same as with regular handlers), for them to finish
13
+
14
+ 4) Kill our testing server
12
15
 
13
16
  5) Setup on our regular digital ocean server
14
17
  - Remove previous startup.sh, and crontab and kill existing tmux services
15
18
  - Setup all the services in the new UI
16
19
  - Copy from the previous startup.sh, running the same services
17
20
  - Changing the UI if anything is extremely annoying, but... I don't see how it would be...
21
+ 5) Verify the editor works
18
22
 
23
+ 6) Verify PathValueServer gracefully shutdowns, not losing any values (because it delays and flushes writes before shutting down, detecting the ctrl+c).
19
24
 
20
25
 
21
- 7.1) Better infinite poll support in shutdown
22
- - Stop all loops
23
- - If any are running, wait (with timeout, same as with regular handlers), for them to finish
24
-
25
26
  7) Quick node removal on process crash or removal
26
27
  Detect the nodeId of services (if they have one), and when the service dies, immediately remove "edgenodes/" file, and trigger an update of "edge-nodes-index.json"
27
28
  - How? Damn it, I have no idea. Maybe... they can determine their screen from their pid and then write to their screen folder? That seems... the best way, even though it's extremely coupling.