mirror of
https://github.com/OneUptime/oneuptime
synced 2024-11-22 07:10:53 +00:00
30 lines
835 B
TypeScript
Executable File
30 lines
835 B
TypeScript
Executable File
import 'CommonServer/utils/env';
|
|
import 'CommonServer/utils/process';
|
|
|
|
import asyncSleep from 'await-sleep';
|
|
|
|
import Main from './Workers/Index';
|
|
import config from './Config';
|
|
import logger from 'CommonServer/Utils/Logger';
|
|
|
|
const cronMinuteStartTime: $TSFixMe = Math.floor(Math.random() * 50);
|
|
|
|
setTimeout(async () => {
|
|
// Keep monitoring in an infinate loop.
|
|
|
|
//eslint-disable-next-line no-constant-condition
|
|
while (true) {
|
|
try {
|
|
await Main.runJob();
|
|
} catch (error) {
|
|
logger.error(error);
|
|
logger.info('Sleeping for 30 seconds...');
|
|
await asyncSleep(30 * 1000);
|
|
}
|
|
}
|
|
}, cronMinuteStartTime * 1000);
|
|
|
|
logger.info(
|
|
`Probe with Probe Name ${config.probeName} and Probe Key ${config.probeKey}. OneUptime Probe API URL: ${config.probeApiUrl}`
|
|
);
|