} // Run private async Task ProcessAsync(SqlConnection con, string connectionString) { var changesCount = await OrmDAL.GetRoutineListCntAsync(con, this.MaxRowDate); if (changesCount > 0) { last0Cnt = null; // commented out changes line, happens too frequently with just 1 change //this.log.Info($"{ changesCount } change(s) found using row date { this.MaxRowDate }"); this.Status = $"{ DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} - { changesCount } change(s) found using rowdate { this.MaxRowDate}"; var changesList = await GetAndProcessRoutineChangesAsync(con, connectionString, changesCount); if (changesList?.Count > 0) { // call save for final changes await this.Endpoint.SaveCacheAsync(); this.GenerateOutputFiles(this.Endpoint, changesList); // save "settings" to persist JsFile version changes SettingsInstance.SaveSettingsToFile(); } }// if changeCount > 0 else { if (last0Cnt == null) { last0Cnt = DateTime.Now; } // only update status if we've been receiving 0 changes for a while if (DateTime.Now.Subtract(last0Cnt.Value).TotalSeconds > 30) { last0Cnt = DateTime.Now; this.Status = $"{ DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} - no changes found"; } // handle the case where the output files no longer exist but we have also not seen any changes on the DB again // TODO: !!! // dbSource.JsFiles.forEach(jsFile => // { // let path = dbSource.outputFilePath(jsFile); // if (!fs.existsSync(path)) // { // this.progress('Generating ' + jsFile.Filename); // JsFileGenerator.generateJsFile(dbSource, jsFile); // //!this.IsRulesDirty = false; // //!this.IsOutputFilesDirty = false; // dbSource.LastUpdateDate = new Date(); // } // }); } } // Process