Skip to content

Commit

Permalink
Accepting Tiho's suggestion to process signals in-loop, reducing use …
Browse files Browse the repository at this point in the history
…of timers
  • Loading branch information
joshmsmith committed Jul 3, 2024
1 parent 51968b5 commit f558c09
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,14 @@ public String accumulateGreetings(
// - if exit signal is received, process any remaining signals and exit
do {

Workflow.await(MAX_AWAIT_TIME, () -> !unprocessedGreetings.isEmpty() || exitRequested);
boolean timedout =
!Workflow.await(MAX_AWAIT_TIME, () -> !unprocessedGreetings.isEmpty() || exitRequested);

if (!unprocessedGreetings.isEmpty()) {
while (!unprocessedGreetings.isEmpty()) {
processGreeting(unprocessedGreetings.removeFirst());
} else {
}

if (exitRequested || timedout) {
String greetEveryone = processGreetings(greetings);

if (unprocessedGreetings.isEmpty()) {
Expand Down

0 comments on commit f558c09

Please sign in to comment.