-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: don't set idle when backtracking, check for forward behind latest backtracking #104
Conversation
@@ -300,7 +300,7 @@ import org.slf4j.Logger | |||
} | |||
|
|||
def nextQuery(state: QueryState): (QueryState, Option[Source[Envelope, NotUsed]]) = { | |||
val newIdleCount = if (state.itemCount == 0) state.idleCount + 1 else 0 | |||
val newIdleCount = if (state.itemCount == 0 && !state.backtracking) state.idleCount + 1 else 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the backtracking query has a definite endpoint in the past, it's not unexpected that a query would return zero items nor would returning zero items suggest anything about whether we're caught up.
case Some(latestBacktracking) if latestBacktracking.isAfter(t.timestamp) && log.isInfoEnabled => | ||
val errStr = s"event from query for persistenceId ${env.persistenceId} seqNr ${env.sequenceNr} " + | ||
s"timestamp ${t.timestamp} was before last event from backtracking or heartbeat $latestBacktracking." | ||
log.info(errStr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could maybe make this debug or throttle in some way... an info log per event might be overkill, but a debug is probably too likely to get lost.
This isn't necessarily a problem, since it will arise if starting from idle in a slice
1d3fb3d
to
6ae1c13
Compare
val newIdleCountBeforeHeartbeat = | ||
if (state.backtracking) state.idleCountBeforeHeartbeat | ||
else if (state.itemCount == 0) state.idleCountBeforeHeartbeat + 1 | ||
else 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I want to play safe here. The idleCount is used for something else so I don't want to risk breaking that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Refs #95 |
No description provided.