session observer session close fixed, kill process fixed and optimized, git submodule path updated
This commit is contained in:
+1
-1
@@ -1,3 +1,3 @@
|
|||||||
[submodule "lib"]
|
[submodule "lib"]
|
||||||
path = lib
|
path = lib
|
||||||
url = http://192.168.1.163:3000/EgorSuv/pixel-streaming-lib
|
url = http://212.220.216.185:3000/EgorSuv/pixel-streaming-lib
|
||||||
|
|||||||
@@ -1,3 +1,14 @@
|
|||||||
|
const {test_config} = require('./tests/config')
|
||||||
|
const {test_titles} = require('./tests/titles')
|
||||||
|
|
||||||
|
if (!test_config()) {
|
||||||
|
process.exit(1)
|
||||||
|
}
|
||||||
|
if (!test_titles()) {
|
||||||
|
process.exit(1)
|
||||||
|
}
|
||||||
|
console.log('all initial tests successfully passed')
|
||||||
|
|
||||||
const {port} = require('./config')
|
const {port} = require('./config')
|
||||||
const app = require('express')()
|
const app = require('express')()
|
||||||
const routes = require('./src/routes')
|
const routes = require('./src/routes')
|
||||||
@@ -6,18 +17,6 @@ const body_parser = require('body-parser')
|
|||||||
const {request_logger, error_logger} = require('./src/middlewares/logger')
|
const {request_logger, error_logger} = require('./src/middlewares/logger')
|
||||||
const {error_handler} = require('./src/middlewares/error_handler')
|
const {error_handler} = require('./src/middlewares/error_handler')
|
||||||
const {start_observer} = require('./src/modules/session_observer')
|
const {start_observer} = require('./src/modules/session_observer')
|
||||||
const {test_config} = require('./tests/config')
|
|
||||||
const {test_titles} = require('./tests/titles')
|
|
||||||
|
|
||||||
if (!test_config()) {
|
|
||||||
process.exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!test_titles()) {
|
|
||||||
process.exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log('all initial tests successfully passed')
|
|
||||||
|
|
||||||
start_observer()
|
start_observer()
|
||||||
|
|
||||||
|
|||||||
@@ -71,6 +71,9 @@ const run_app = async (app_path, app_port) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const kill_proc = (pid) => {
|
const kill_proc = (pid) => {
|
||||||
|
if (!is_proc_running(pid)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
if (process.platform === 'win32') {
|
if (process.platform === 'win32') {
|
||||||
spawn('taskkill', ['/pid', pid, '/f', '/t'])
|
spawn('taskkill', ['/pid', pid, '/f', '/t'])
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,20 +24,24 @@ const check_sessions = async (sessions) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if something running kill process and skip remove from database
|
// if something running kill process and skip remove from database
|
||||||
if (!webrtc_running && !app_running) {
|
if (!webrtc_running || !app_running) {
|
||||||
if (!pending_list.is_waiting(session.session_id)) {
|
// if session already in peding list skip
|
||||||
pending_list.add(session.session_id)
|
if (pending_list.is_waiting(session.session_id)) {
|
||||||
var close_session_result = await coordinator.close_session(session.session_id)
|
return
|
||||||
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 {
|
pending_list.add(session.session_id)
|
||||||
|
|
||||||
|
// kill process if running
|
||||||
kill_proc(session.webrtc_pid)
|
kill_proc(session.webrtc_pid)
|
||||||
kill_proc(session.app_pid)
|
kill_proc(session.app_pid)
|
||||||
|
|
||||||
|
var close_session_result = await coordinator.close_session(session.session_id)
|
||||||
|
if (close_session_result) {
|
||||||
|
await database.remove_running_session(session.session_id)
|
||||||
|
} else {
|
||||||
|
console.log('can not connect to coordinator')
|
||||||
|
}
|
||||||
|
pending_list.remove(session.session_id)
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"title":"test-ivazowsky",
|
"title":"not-supported-test-ivazowsky",
|
||||||
"path":"D:/shared/Builds/ivazowsky/Ivaz_Optimized_2/Ivazowsky.exe"
|
"path":"D:/shared/Builds/ivazowsky/Ivaz_Optimized_2/Ivazowsky.exe"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user