fix: timeout issue

This commit is contained in:
Quan Luu
2022-09-01 08:06:09 +07:00
parent 39149af9cc
commit 489f20a2cd
2 changed files with 3 additions and 2 deletions

3
app.js
View File

@@ -51,7 +51,7 @@ srf.on('connect', (err, hp) => {
// Only run when I'm the first member in the set Of Actip Sip SBC
const set = await retrieveSet(setName);
const newArray = Array.from(set);
let startRegBot = !newArray || newArray.length == 0;
let startRegBot = !newArray || newArray.length === 0;
if (!startRegBot) {
const firstSbc = newArray.at(0);
const hostports = hp.split(',');
@@ -67,6 +67,7 @@ srf.on('connect', (err, hp) => {
srf.locals.regbotStatus = require('./lib/sip-trunk-register')(logger, srf);
} else {
// Timer 30 seconds to make sure the task is transfered to another SBC outbound handler
// In case the first server is dead.
setTimeout(ativateRegBot.bind(this, err, hp), 30 * 1000);
}
};

View File

@@ -119,7 +119,7 @@ test('trunk register tests when its IP in redis cache', (t) => {
});
});
test('trunk not register tests when its IP in redis cache', (t) => {
test('trunk not register tests when its IP is not in redis cache', (t) => {
clearModule.all();
const { srf } = require('../app');
t.timeoutAfter(60000);