diff --git a/server/src/cronTasks.js b/server/src/cronTasks.js index 824acb8..7d5f68c 100644 --- a/server/src/cronTasks.js +++ b/server/src/cronTasks.js @@ -6,8 +6,6 @@ import oui from 'oui' import { deleteOldLogs, log, logInfo, logSuccess } from './lib/logger' -import { updateUserIdMappings } from './lib/paloalto' - logInfo({ tags: ['cron'], message: 'Scheduling tasks...' diff --git a/server/src/index.js b/server/src/index.js index 9041265..b91336f 100755 --- a/server/src/index.js +++ b/server/src/index.js @@ -15,7 +15,7 @@ logInfo({ : 'Running in development' }) -import './tasks' +import { runTasks } from './tasks' import './cronTasks' server.listen().then(options => { @@ -28,3 +28,5 @@ server.listen().then(options => { } }) }) + +runTasks() diff --git a/server/src/tasks.js b/server/src/tasks.js index 1e02ab6..ebce941 100644 --- a/server/src/tasks.js +++ b/server/src/tasks.js @@ -4,11 +4,6 @@ import { updateDevicesInfo } from './lib/wifiDevices' const SLEEP_IN_MILLISECONDS = process.env.TASK_SLEEP || 10000 -logInfo({ - tags: ['task'], - message: `Running tasks with ${SLEEP_IN_MILLISECONDS}ms sleeps.` -}) - async function updateDevicesTask() { try { logInfo({ @@ -34,4 +29,13 @@ async function updateDevicesTask() { } } -updateDevicesTask() +function runTasks() { + logInfo({ + tags: ['task'], + message: `Running tasks with ${SLEEP_IN_MILLISECONDS}ms sleeps.` + }) + + updateDevicesTask() +} + +export { runTasks }