mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-19 04:17:44 +00:00
disable node.js cleanup
This commit is contained in:
25
app.js
25
app.js
@@ -204,17 +204,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};
|
||||
|
||||
@@ -2,9 +2,7 @@ const {execSync} = require('child_process');
|
||||
const {
|
||||
JAMBONES_FREESWITCH,
|
||||
NODE_ENV,
|
||||
JAMBONES_FREESWITCH_MAX_CALL_DURATION_MINS,
|
||||
TMP_FOLDER,
|
||||
JAMBONZ_CLEANUP_INTERVAL_MINS
|
||||
JAMBONES_FREESWITCH_MAX_CALL_DURATION_MINS
|
||||
} = require('../config');
|
||||
const now = Date.now();
|
||||
const fsInventory = JAMBONES_FREESWITCH
|
||||
@@ -48,12 +46,12 @@ const clearChannels = () => {
|
||||
return calls.length;
|
||||
};
|
||||
|
||||
const clearFiles = () => {
|
||||
// Remove temp audiofiles that were not auto deleted older 300 min (or CLEANUP_INTERVAL if set) from TMP_FOLDER
|
||||
const maxAge = JAMBONZ_CLEANUP_INTERVAL_MINS || 300;
|
||||
execSync(`/usr/local/bin/cleanup-temp-audiofiles.sh ${maxAge} ${TMP_FOLDER};`);
|
||||
};
|
||||
// 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 };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user