querysub 0.246.0 → 0.247.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
|
@@ -267,7 +267,12 @@ const runScreenCommand = measureWrap(async function runScreenCommand(config: {
|
|
|
267
267
|
if (pid && await isScreenRunningProcess(pid)) {
|
|
268
268
|
// It doesn't want to die. Wait longer, but it it just won't die, kill the screen
|
|
269
269
|
console.warn(`Screen ${screenName} is not dying, giving it another 30 seconds`);
|
|
270
|
-
|
|
270
|
+
for (let i = 0; i < 6; i++) {
|
|
271
|
+
await delay(5);
|
|
272
|
+
if (!await isScreenRunningProcess(pid)) {
|
|
273
|
+
break;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
271
276
|
if (pid && await isScreenRunningProcess(pid)) {
|
|
272
277
|
console.warn(`Screen ${screenName} is still running, killing it forcefully`);
|
|
273
278
|
await killScreen({ screenName });
|
|
@@ -297,9 +302,6 @@ ${config.command}
|
|
|
297
302
|
let pipeScript = path.resolve(config.folder + "../pipe.sh");
|
|
298
303
|
await fs.promises.writeFile(pipeScript, `#!/bin/bash
|
|
299
304
|
line_count=0
|
|
300
|
-
max_lines_limit=$((${PIPE_FILE_LINE_LIMIT} * 100))
|
|
301
|
-
keep_lines_count=$((${PIPE_FILE_LINE_LIMIT} * 50))
|
|
302
|
-
|
|
303
305
|
while IFS= read -r line; do
|
|
304
306
|
echo "$line" >> "${pipeFile}"
|
|
305
307
|
((line_count++))
|
|
@@ -309,9 +311,9 @@ while IFS= read -r line; do
|
|
|
309
311
|
if [ -f "${pipeFile}" ]; then
|
|
310
312
|
# Count total lines in file
|
|
311
313
|
total_lines=$(wc -l < "${pipeFile}")
|
|
312
|
-
if [ "$total_lines" -gt
|
|
313
|
-
# Keep only the last
|
|
314
|
-
tail -n
|
|
314
|
+
if [ "$total_lines" -gt ${PIPE_FILE_LINE_LIMIT} ]; then
|
|
315
|
+
# Keep only the last ${PIPE_FILE_LINE_LIMIT} lines when file gets too many lines
|
|
316
|
+
tail -n ${Math.floor(PIPE_FILE_LINE_LIMIT / 2)} "${pipeFile}" > "${pipeFile}.tmp" && mv "${pipeFile}.tmp" "${pipeFile}"
|
|
315
317
|
fi
|
|
316
318
|
fi
|
|
317
319
|
fi
|