From d06d0a32bfea1bb01bd95244ea5c7700a7387dfa Mon Sep 17 00:00:00 2001 From: Joe Tretter Date: Tue, 9 Apr 2019 14:20:21 -0500 Subject: [PATCH] Implement a non-polling flag in the DB-Extractor --- DBExtractor/DBExtractor.config.json.example | 3 ++- DBExtractor/DBExtractor.js | 9 +++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/DBExtractor/DBExtractor.config.json.example b/DBExtractor/DBExtractor.config.json.example index e296cc6..627f9bc 100644 --- a/DBExtractor/DBExtractor.config.json.example +++ b/DBExtractor/DBExtractor.config.json.example @@ -5,9 +5,10 @@ "serverURI": "http://localhost:2222", "maxResultsPerMessage":100, "statements":{ - "poller":"'select top ' + config.maxResultsPerMessage + ' * from rpslog with (nolock) where pkey > \\'' + maxPKey + '\\' and businessModified < dateAdd(mi,-30, getdate()) order by pkey'" + "poller":"'select top ' + config.maxResultsPerMessage + ' * from rpslog with (nolock) where pkey > \\'' + maxPKey + '\\' order by pkey'" }, "pollIntervalIdle": 10000, + "pollMode": false, "UP_sqlConfig": { "user": "casdbuser", "password": "4KcLao2016!", diff --git a/DBExtractor/DBExtractor.js b/DBExtractor/DBExtractor.js index 9e2dfe1..49090ea 100644 --- a/DBExtractor/DBExtractor.js +++ b/DBExtractor/DBExtractor.js @@ -99,8 +99,13 @@ try { }); process.stdout.write(">" + allRows.length + ">"); } else { - theInterval = setInterval(runNextPoll, config.pollIntervalIdle); - process.stdout.write("."); + if (config.pollMode) { + theInterval = setInterval(runNextPoll, config.pollIntervalIdle); + process.stdout.write("."); + } else { + sql.close(); + return(true); + } } allRows=[];