samples-java icon indicating copy to clipboard operation
samples-java copied to clipboard

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

Open stiwari99 opened this issue 1 year ago • 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

stiwari99 avatar Aug 08 '23 17:08 stiwari99