config tests added,

titles tests added,
.env file support added with dotenv,
README.md file updated for .evn file support,
database lost connection bug crash fixed,
session server run_session long timeout bug fixed,
links module added,
webrtc_proc json arguments added,
app_proc stdout and stderr support added,
infinity app_proc spawn freeze bug fixed
This commit is contained in:
C
2023-01-30 17:55:15 +05:00
parent e3e2cc97aa
commit dae22f393c
14 changed files with 3222 additions and 26 deletions
+14 -4
View File
@@ -10,7 +10,7 @@ const is_proc_running = (pid) => {
return is_running(pid)
}
const is_proc_running_async = async (pid, check_time) => {
const is_proc_running_async = async (pid, time_ms) => {
var timeout_count = 0
var check_times = 10
@@ -22,7 +22,7 @@ const is_proc_running_async = async (pid, check_time) => {
if (timeout_count > check_times) {
return true
}
await new Promise(resolve => setTimeout(resolve, check_time / check_times))
await new Promise(resolve => setTimeout(resolve, time_ms / check_times))
}
}
@@ -33,7 +33,8 @@ const run_webrtc = async (webrtc_port, app_port) => {
var webrtc_proc
try {
webrtc_proc = fork(webrtc_server_path, [webrtc_port.toString(), app_port.toString()], {
var webrtc_proc_arg = JSON.stringify({webrtc_port:webrtc_port, app_port:app_port})
webrtc_proc = fork(webrtc_server_path, [webrtc_proc_arg], {
detached: true
})
} catch (err) {
@@ -49,9 +50,18 @@ const run_app = async (app_path, app_port) => {
var app_proc
try {
app_proc = spawn(app_path, [].concat(app_args_static,
[app_port_arg + app_port.toString()]), {
[app_port_arg + app_port.toString()], { cwd: './', stdio: ['ignore', 'pipe', 'pipe']}), {
detached: true
})
// bind some events to unfreez process
app_proc.stdout.on('data', data => {
//console.log('stdout: ' + data.toString());
})
app_proc.stderr.on('data', data => {
//console.log('stderr: ' + data.toString());
})
} catch (err) {
return null
}