use of com.netflix.titus.grpc.protogen.ObserveJobsWithKeepAliveRequest in project titus-control-plane by Netflix.
the class ObserveJobsSubscription method getLastKeepAliveEvent.
private KeepAliveRequest getLastKeepAliveEvent() {
Pair<Long, ObserveJobsWithKeepAliveRequest> firstKeepAliveRequestPair = null;
KeepAliveRequest lastKeepAliveRequest = null;
int count = 0;
Pair<Long, ObserveJobsWithKeepAliveRequest> eventPair;
while ((eventPair = grpcClientEvents.peek()) != null) {
ObserveJobsWithKeepAliveRequest event = eventPair.getRight();
if (event.getKindCase() == ObserveJobsWithKeepAliveRequest.KindCase.KEEPALIVEREQUEST) {
long requestTimestampNano = eventPair.getLeft();
if (requestTimestampNano > lastCheckpointTimestampNano) {
break;
}
lastKeepAliveRequest = event.getKeepAliveRequest();
count++;
if (firstKeepAliveRequestPair == null) {
firstKeepAliveRequestPair = eventPair;
}
}
grpcClientEvents.poll();
}
if (lastKeepAliveRequest != null && logger.isDebugEnabled()) {
KeepAliveRequest firstKeepAliveRequest = firstKeepAliveRequestPair.getRight().getKeepAliveRequest();
long internalSyncDelayMs = (System.nanoTime() - firstKeepAliveRequestPair.getLeft()) / 1_000_000;
logger.debug("Acknowledging the keep alive request(s): count={}, requestId(first)={}, requestTimestamp={}, internalSyncDelayMs={}", count, firstKeepAliveRequest.getRequestId(), firstKeepAliveRequest.getTimestamp(), internalSyncDelayMs);
}
return lastKeepAliveRequest;
}
Aggregations