Abhitocode commented on code in PR #7313:
URL: https://github.com/apache/incubator-kie/pull/7313#discussion_r4671250891


##########
kogito-quarkus/addons/persistence/kafka/runtime/src/main/java/org/kie/kogito/persistence/kafka/KafkaProcessInstances.java:
##########
@@ -218,13 +217,13 @@ protected void connectInstance(ProcessInstance<?> 
instance) {
     @Override
     public Stream<ProcessInstance<T>> waitingForEventType(String eventType, 
ProcessInstanceReadMode mode) {
 
-        KeyValueIterator<String, byte[]> iterator = 
getStore().prefixScan("events-" + getProcess().id(), 
Serdes.String().serializer());
-        if (!iterator.hasNext()) {
-            return Collections.<ProcessInstance<T>> emptyList().stream();
+        byte[] eventData;
+        try (KeyValueIterator<String, byte[]> iterator = 
getStore().prefixScan("events-" + getProcess().id(), 
Serdes.String().serializer())) {

Review Comment:
   One small suggestion, the events record is stored under the exact key` 
events-<processId>`, so `getStore().get(getKeyForEvents())` would do the same 
job without any iterator (tried it, the existing ITs pass and the iterator 
count stays at zero).
   



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to