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:
@@ -2,8 +2,10 @@ const run_process = require('../modules/run_process')
|
||||
const database = require('../database/database')
|
||||
const {is_proc_running, kill_proc} = require('./run_process')
|
||||
const coordinator = require('./coordinator')
|
||||
const wait_list = require('./wait_list')
|
||||
|
||||
const observer_timeout = 100
|
||||
var pending_list = new wait_list([])
|
||||
|
||||
const start_observer = () => {
|
||||
check()
|
||||
@@ -16,16 +18,22 @@ const check_sessions = async (sessions) => {
|
||||
await Promise.all(sessions.map(async (session) => {
|
||||
var webrtc_running = is_proc_running(session.webrtc_pid)
|
||||
var app_running = is_proc_running(session.app_pid)
|
||||
|
||||
|
||||
if (webrtc_running && app_running) {
|
||||
return
|
||||
}
|
||||
|
||||
// if something running kill process and skip remove from database
|
||||
if (!webrtc_running && !app_running) {
|
||||
var close_session_result = await coordinator.close_session(session.session_id)
|
||||
if (close_session_result) {
|
||||
database.remove_running_session(session.session_id)
|
||||
if (!pending_list.is_waiting(session.session_id)) {
|
||||
pending_list.add(session.session_id)
|
||||
var close_session_result = await coordinator.close_session(session.session_id)
|
||||
if (close_session_result) {
|
||||
database.remove_running_session(session.session_id)
|
||||
} else {
|
||||
pending_list.remove(session.session_id)
|
||||
console.log('can not connect to coordinator')
|
||||
}
|
||||
}
|
||||
} else {
|
||||
kill_proc(session.webrtc_pid)
|
||||
@@ -36,7 +44,7 @@ const check_sessions = async (sessions) => {
|
||||
|
||||
const check = async () => {
|
||||
var sessions = await database.get_running_sessions()
|
||||
|
||||
|
||||
if (!sessions) {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user