temporalio/samples-java

[Bug] SlidingWindowBatchWorkflowImpl.java recived signals are getting ignored if currentRecords is empty

stiwari99 opened this issue · 0 comments

What are you really trying to do?

Describe the bug

If signal is received when currentRecords is empty instead of null then it will not add it to recordsToRemove list which is causing Workflow.await(() -> currentRecords.size() == 0); to wait indefinite
https://github.com/temporalio/samples-java/blob/main/core/src/main/java/io/temporal/samples/batch/slidingwindow/SlidingWindowBatchWorkflowImpl.java#L130

Current Code

 if (currentRecords == null) {
      recordsToRemove.add(recordId);
      return;
    }

Expected change

 if (currentRecords == null || currentRecords.isEmpty()) {
      recordsToRemove.add(recordId);
      return;
    }

Minimal Reproduction

Environment/Versions

  • OS and processor: [e.g. M1 Mac, x86 Windows, Linux]
  • Temporal Version: [e.g. 1.14.0?] and/or SDK version
  • Are you using Docker or Kubernetes or building Temporal from source?

Additional context