config fixed, session server timeout increased

This commit is contained in:
C
2023-01-25 17:23:37 +05:00
parent 7efb6a31cb
commit 0c0201622b
4 changed files with 6 additions and 4 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
module.exports = { module.exports = {
port: process.env.PORT, port: parseInt(process.env.PORT),
database_url: process.env.DATABASE_URL, database_url: process.env.DATABASE_URL,
database_name: process.env.DATABASE_NAME, database_name: process.env.DATABASE_NAME,
log_path: "./logs/runtime.log", log_path: "./logs/runtime.log",
+1 -1
View File
@@ -28,7 +28,7 @@ const create_session = async (req, res, next) => {
var websocket_url = await run_session(session_server.url, session_id, title) var websocket_url = await run_session(session_server.url, session_id, title)
if (!websocket_url) { if (!websocket_url) {
next(new not_found_error('websocket_url not valid')) next(new not_found_error('can not run session'))
return return
} }
+1
View File
@@ -11,6 +11,7 @@ const get_db = async () => {
try { try {
await client.connect() await client.connect()
} catch (err) { } catch (err) {
console.log('can not connect to database')
return null return null
} }
return client.db(database_name) return client.db(database_name)
+3 -2
View File
@@ -1,5 +1,6 @@
var request = require('request') var request = require('request')
let max_response_timeout = 1000 const max_response_timeout = 1000
const max_run_session_timeout = 10000
const get_fastest_session_server = async (free_servers) => { const get_fastest_session_server = async (free_servers) => {
var fastest_server = null var fastest_server = null
@@ -44,7 +45,7 @@ const run_session = async (server_url, session_id, title) => {
var options = { var options = {
url: server_url + '/session/run', url: server_url + '/session/run',
method: "POST", method: "POST",
timeout: max_response_timeout, timeout: max_run_session_timeout,
headers: { headers: {
"content-type": "application/json" "content-type": "application/json"
}, },