You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streams.apache.org by mf...@apache.org on 2014/07/29 22:41:55 UTC
git commit: STREAMS-44 | Updated provider to handle a minor amount of
lag in the Sysomos System.
Repository: incubator-streams
Updated Branches:
refs/heads/master c454d52f2 -> cbfe01a8b
STREAMS-44 | Updated provider to handle a minor amount of lag in the Sysomos System.
Project: http://git-wip-us.apache.org/repos/asf/incubator-streams/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-streams/commit/cbfe01a8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-streams/tree/cbfe01a8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-streams/diff/cbfe01a8
Branch: refs/heads/master
Commit: cbfe01a8bbfa702324a39e8e749ee2907f2e0d76
Parents: c454d52
Author: mfranklin <mf...@apache.org>
Authored: Tue Jul 29 16:07:13 2014 -0400
Committer: mfranklin <mf...@apache.org>
Committed: Tue Jul 29 16:07:13 2014 -0400
----------------------------------------------------------------------
.../streams/sysomos/provider/SysomosHeartbeatStream.java | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/cbfe01a8/streams-contrib/streams-provider-sysomos/src/main/java/org/apache/streams/sysomos/provider/SysomosHeartbeatStream.java
----------------------------------------------------------------------
diff --git a/streams-contrib/streams-provider-sysomos/src/main/java/org/apache/streams/sysomos/provider/SysomosHeartbeatStream.java b/streams-contrib/streams-provider-sysomos/src/main/java/org/apache/streams/sysomos/provider/SysomosHeartbeatStream.java
index 3478671..64cc0e8 100644
--- a/streams-contrib/streams-provider-sysomos/src/main/java/org/apache/streams/sysomos/provider/SysomosHeartbeatStream.java
+++ b/streams-contrib/streams-provider-sysomos/src/main/java/org/apache/streams/sysomos/provider/SysomosHeartbeatStream.java
@@ -86,11 +86,13 @@ public class SysomosHeartbeatStream implements Runnable {
protected void executeRun() {
QueryResult result;
String mostCurrentId = null;
+ int totalDocCount = 0;
lastRunTime = DateTime.now();
//Iff we are trying to get to a specific document ID, continue to query after minimum delay
do {
LOGGER.debug("Querying API to match last ID of {} or time range of {} - {}", lastID, afterTime, beforeTime);
result = queryAPI();
+ totalDocCount += result.getResponseSize();
//Ensure that we are only assigning lastID to the latest ID, even if there is backfill query.
//Since offset is calcuated at the end of the run, if we detect the need to backfill, it will increment to 1
if(offsetCount == 1) {
@@ -99,17 +101,18 @@ public class SysomosHeartbeatStream implements Runnable {
updateOffset(result);
} while (offsetCount > 0);
- updateState(result, mostCurrentId);
+ updateState(result, mostCurrentId, totalDocCount);
LOGGER.debug("Completed current execution with a final docID of {} or time of {}", lastID, afterTime);
}
- protected void updateState(QueryResult result, String mostCurrentId) {
+ protected void updateState(QueryResult result, String mostCurrentId, int totalDocCount) {
if(OperatingMode.DOC_MATCH.equals(mode)) {
//Set the last ID so that the next time we are executed we will continue to query only so long as we haven't
//found the specific ID
lastID = mostCurrentId == null ? result.getCurrentId() : mostCurrentId;
} else {
- afterTime = lastRunTime;
+ //If we didn't see any docs, there might be a lag on the Sysomos side. Retry.
+ afterTime = totalDocCount == 0 ? afterTime : lastRunTime;
}
if(SysomosProvider.Mode.BACKFILL_AND_TERMINATE.equals(provider.getMode())) {