tzulitai commented on a change in pull request #30: [FLINK-16226] Add
Backpressure to HttpFunction
URL: https://github.com/apache/flink-statefun/pull/30#discussion_r382876533
##########
File path:
statefun-flink/statefun-flink-core/src/main/java/org/apache/flink/statefun/flink/core/httpfn/HttpFunction.java
##########
@@ -109,9 +137,17 @@ private void onAsyncResult(
handleInvocationResponse(context, invocationResult);
InvocationBatchRequest.Builder nextBatch = getNextBatch();
if (nextBatch == null) {
- hasInFlightRpc.clear();
+ // the async request was completed, and there is nothing else in the
batch
+ // so we clear the requestState.
+ requestState.clear();
return;
}
+ // an async request was just completed, but while it was in flight we have
+ // accumulated a batch, we now proceed with:
+ // a) clearing the batch from our own persisted state (the batch moves to
the async operation
+ // state)
+ // b) sending the accumulated batch to the remote function.
+ requestState.set(0);
Review comment:
On the other hand, if the intended semantics is that we only backpressure
when local accumulated batch exceeds threshold, and not accounting number of
in-flights (records, not requests; a batch request would have multiple
records), then probably `inflightOrBatched` should be renamed to `batchedSize`.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services