function checkFileLoop()

in greengrass-opcua-adapter-nodejs/config_agent.js [295:320]


function checkFileLoop(callback) {
    var obj = setInterval(()=> {
        clearInterval(obj);

        // check server file config file
        var stats = fs.statSync(`${folder}/${serverConfigfileName}`);
        var mtime = stats.mtime;

        /* update process running status if the feature is set and failure time less than readFailTolerance. */
        if ( reportStatus && readFailTimes < readFailTolerance )
        {
            reportSystemStatus();
        }

        // File modified due to different date
        if (!datesEqual(mtime, LastModifiedtime)) {
            LastModifiedtime = mtime;
            callback();
        }

        if (clientOptions.checkServerConfigInterval > 0) {
            timeout = clientOptions.checkServerConfigInterval;
        }
        checkFileLoop(callback);
    }, timeout);
}