You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/05/17 23:29:03 UTC
[GitHub] [pulsar] nlu90 commented on a change in pull request #10618: [Functions] Process async results in the same Java runnable thread
nlu90 commented on a change in pull request #10618:
URL: https://github.com/apache/pulsar/pull/10618#discussion_r633929657
##########
File path: pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/instance/JavaInstanceRunnable.java
##########
@@ -272,11 +273,12 @@ public void run() {
removeLogTopicHandler();
- try {
- processResult(currentRecord, result);
- } catch (Exception e) {
- log.warn("Failed to process result of message {}", currentRecord, e);
- currentRecord.fail();
+ // process the synchronous results
+ if (result != null) {
+ handleResult(currentRecord, result);
+ } else {
+ // process the asynchronous results
+ processAsyncResults();
Review comment:
The `null` result indicates the current record is placed into the queue for async processing.
The `processAsyncResults()` method takes the first element from the queue and checks/proceeds with the result.
1. It seems a newly added record triggers the check of whether the oldest added record is done. This behavior is undesirable since records are independent.
2. I'm wondering there'll always be one element left in the queue regardless whether it's done or not.
--
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:
users@infra.apache.org