Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,8 @@ private[connect] class ExecuteGrpcResponseSender[T <: Message](
// 2. has a response to send
def gotResponse = response.nonEmpty
// 3. sent everything from the stream and the stream is finished
def streamFinished = executionObserver.getLastResponseIndex().exists(nextIndex > _)
def streamFinished = executionObserver.getLastResponseIndex().exists(nextIndex > _) ||
executionObserver.isCleaned()
// 4. time deadline or size limit reached
def deadlineLimitReached =
sentResponsesSize > maximumResponseSize || deadlineTimeNs < System.nanoTime()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,11 @@ private[connect] class ExecuteResponseObserver[T <: Message](val executeHolder:
finalProducedIndex.isDefined
}

// Returns if this observer has already been cleaned
def isCleaned(): Boolean = responseLock.synchronized {
completed() && responses.isEmpty
}

// For testing.
private[connect] def undoCompletion(): Unit = responseLock.synchronized {
finalProducedIndex = None
Expand Down