querysub 0.229.0 → 0.231.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.229.0",
3
+ "version": "0.231.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",
@@ -172,14 +172,18 @@ const runScreenCommand = measureWrap(async function runScreenCommand(config: {
172
172
  await runPromise(`${prefix}tmux send-keys -t ${screenName} 'echo "Updating running command at ${new Date().toISOString()}"' Enter`);
173
173
  await runPromise(`${prefix}tmux send-keys -t ${screenName} 'C-c' Enter`);
174
174
  await delay(1000);
175
- if (await isScreenRunningProcess(screenName)) {
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)) {
176
180
  // It doesn't want to die. Wait longer, but it it just won't die, kill the screen
177
181
  console.warn(`Screen ${screenName} is not dying, giving it another 30 seconds`);
178
182
  await delay(timeInSecond * 30);
179
- if (await isScreenRunningProcess(screenName)) {
183
+ if (pid && await isScreenRunningProcess(pid)) {
180
184
  console.warn(`Screen ${screenName} is still running, killing it forcefully`);
181
185
  await killScreen({ screenName });
182
- if (await isScreenRunningProcess(screenName)) {
186
+ if (pid && await isScreenRunningProcess(pid)) {
183
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...`);
184
188
  } else {
185
189
  // Nested, to create the screen again.
@@ -193,7 +197,11 @@ const runScreenCommand = measureWrap(async function runScreenCommand(config: {
193
197
  }
194
198
  }
195
199
  await runPromise(`${prefix}tmux send-keys -t ${screenName} 'cd ${config.folder}' Enter`);
196
- 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`);
197
205
  });
198
206
  const killScreen = measureWrap(async function killScreen(config: {
199
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.