Compare commits

...

5 Commits

Author SHA1 Message Date
Sam Machin
b3759d9c81 lint 2025-07-29 10:05:45 -04:00
Sam Machin
41106ddfc1 disable node.js cleanup 2025-07-29 10:05:45 -04:00
Sam Machin
55939752e2 lint 2025-07-29 10:05:45 -04:00
Sam Machin
f03ec420bf lint 2025-07-29 10:05:45 -04:00
Sam Machin
10a2b15279 Update cron-jobs.js 2025-07-29 10:05:45 -04:00
3 changed files with 27 additions and 28 deletions

27
app.js
View File

@@ -5,8 +5,6 @@ const {
JAMBONES_OTEL_SERVICE_NAME,
JAMBONES_LOGLEVEL,
JAMBONES_CLUSTER_ID,
JAMBONZ_CLEANUP_INTERVAL_MINS,
getCleanupIntervalMins,
K8S,
NODE_ENV,
checkEnvs,
@@ -204,17 +202,20 @@ async function handle(signal) {
}
}
if (JAMBONZ_CLEANUP_INTERVAL_MINS) {
const {clearFiles} = require('./lib/utils/cron-jobs');
// Disabled in favour of OS Level Cron Job, TODO Remove in later release
//
//if (JAMBONZ_CLEANUP_INTERVAL_MINS) {
// const {clearFiles} = require('./lib/utils/cron-jobs');
// /* cleanup orphaned files or channels every so often */
// setInterval(async() => {
// try {
// await clearFiles();
// } catch (err) {
// logger.error({err}, 'app.js: error clearing files');
// }
// }, getCleanupIntervalMins());
//}
/* cleanup orphaned files or channels every so often */
setInterval(async() => {
try {
await clearFiles();
} catch (err) {
logger.error({err}, 'app.js: error clearing files');
}
}, getCleanupIntervalMins());
}
module.exports = {srf, logger, disconnect};

View File

@@ -82,11 +82,11 @@ const K8S_SBC_SIP_SERVICE_NAME = process.env.K8S_SBC_SIP_SERVICE_NAME;
const JAMBONES_SUBNET = process.env.JAMBONES_SUBNET;
/* clean up */
const JAMBONZ_CLEANUP_INTERVAL_MINS = process.env.JAMBONZ_CLEANUP_INTERVAL_MINS;
const getCleanupIntervalMins = () => {
const interval = parseInt(JAMBONZ_CLEANUP_INTERVAL_MINS, 10) || 60;
return 1000 * 60 * interval;
};
//const JAMBONZ_CLEANUP_INTERVAL_MINS = process.env.JAMBONZ_CLEANUP_INTERVAL_MINS;
//const getCleanupIntervalMins = () => {
// const interval = parseInt(JAMBONZ_CLEANUP_INTERVAL_MINS, 10) || 60;
// return 1000 * 60 * interval;
//};
/* speech vendors */
const AWS_REGION = process.env.AWS_REGION;
@@ -184,8 +184,6 @@ module.exports = {
K8S_SBC_SIP_SERVICE_NAME,
JAMBONES_SUBNET,
NODE_ENV,
JAMBONZ_CLEANUP_INTERVAL_MINS,
getCleanupIntervalMins,
checkEnvs,
AWS_REGION,

View File

@@ -2,7 +2,7 @@ const {execSync} = require('child_process');
const {
JAMBONES_FREESWITCH,
NODE_ENV,
JAMBONES_FREESWITCH_MAX_CALL_DURATION_MINS,
JAMBONES_FREESWITCH_MAX_CALL_DURATION_MINS
} = require('../config');
const now = Date.now();
const fsInventory = JAMBONES_FREESWITCH
@@ -46,12 +46,12 @@ const clearChannels = () => {
return calls.length;
};
const clearFiles = () => {
//const {logger} = require('../..');
/*const out = */ execSync('find /tmp -name "*.mp3" -mtime +2 -exec rm {} \\;');
//logger.debug({out}, 'clearFiles: command output');
};
// Disabled in favour of OS Level Cron Job, TODO Remove in later release
//const clearFiles = () => {
// //const {logger} = require('../..');
// /*const out = */ execSync('find /tmp -name "*.mp3" -mtime +2 -exec rm {} \\;');
// //logger.debug({out}, 'clearFiles: command output');
//}
module.exports = {clearChannels, clearFiles};
module.exports = {clearChannels };