imports/vx/server/daemon/daemon.js
/**
     * Clobber then initialize the DaemonJobs collection. The collection is intentionally
     * initialized in a manner that will cause all jobs to fire immediately after startup
     * regardless of schedule.
     */
Clobber then initialize the DaemonJobs collection. The collection is intentionally
initialized in a manner that will cause all jobs to fire immediately after startup
regardless of schedule.
Clobber then initialize the DaemonJobs collection . The collection is intentionally initialized in a manner that will cause all jobs to fire immediately after startup regardless of schedule .
initDaemonJobs() {
        DaemonJobs.remove({})
        const nowDate = new Date()
        Util.getCodes("daemonJob").forEach(jobName => {
            const daemonJobObject = Util.getCodeObject("daemonJob", jobName)
            const daemonJob = {}
            daemonJob.jobName = jobName
            daemonJob.timeInterval = daemonJobObject.timeInterval
            daemonJob.timeUnit = daemonJobObject.timeUnit
            daemonJob.timeOption = daemonJobObject.timeOption
            daemonJob.timezone = daemonJobObject.timezone
            daemonJob.nextDate = Util.computeNextDate(daemonJobObject.timeInterval, daemonJobObject.timeUnit,
                daemonJobObject.timeOption, daemonJobObject.timezone, nowDate)
            daemonJob.initFunctionName = daemonJobObject.initFunctionName
            daemonJob.execFunctionName = daemonJobObject.execFunctionName
            OLog.debug(`daemon.js initDaemonJobs daemonJob=${OLog.debugString(daemonJob)}`)
            if (daemonJob.initFunctionName) {
                try {
                    const func = get(global, daemonJob.initFunctionName)
                    func(daemonJob)
                }
                catch (error) {
                    OLog.error(`daemon.js initDaemonJobs unexpected error jobName=${daemonJob.jobName} ` +
                        `error=${error}`)
                }
            }
            DaemonJobs.insert(daemonJob)
        })
    }
initDaemonJobs ( ) { DaemonJobs . remove ( { } ) const nowDate = new Date ( ) Util . getCodes ( "daemonJob" ) . forEach ( jobName => { const daemonJobObject = Util . getCodeObject ( "daemonJob" , jobName ) const daemonJob = { } daemonJob . jobName = jobName daemonJob . timeInterval = daemonJobObject . timeInterval daemonJob . timeUnit = daemonJobObject . timeUnit daemonJob . timeOption = daemonJobObject . timeOption daemonJob . timezone = daemonJobObject . timezone daemonJob . nextDate = Util . computeNextDate ( daemonJobObject . timeInterval , daemonJobObject . timeUnit , daemonJobObject . timeOption , daemonJobObject . timezone , nowDate ) daemonJob . initFunctionName = daemonJobObject . initFunctionName daemonJob . execFunctionName = daemonJobObject . execFunctionName OLog . debug ( ` ${ OLog . debugString ( daemonJob ) } ` ) if ( daemonJob . initFunctionName ) { try { const func = get ( global , daemonJob . initFunctionName ) func ( daemonJob ) } catch ( error ) { OLog . error ( ` ${ daemonJob . jobName } ` + ` ${ error } ` ) } } DaemonJobs . insert ( daemonJob ) } ) }
Clobber then initialize the DaemonJobs collection.
Clobber then initialize the DaemonJobs collection .