Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix zero consumer behaviour #94

Merged
merged 2 commits into from
Nov 5, 2021

Conversation

chinghongfang
Copy link
Collaborator

Problem in #41 comment.

Solved:
When there is no consumer, the tracker will not print out the consumers information.
And will terminate after the producers are done.

When there is no consumer, the tracker will not print out the
consumers information. And will terminate after the producers are
done.
Copy link
Contributor

@chia7712 chia7712 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chinghongfang thanks for this fix. Could you please add unit test

@@ -43,6 +43,9 @@ public State execute() throws InterruptedException {
System.out.printf(
" producer[%d]的發送average latency: %.3fms%n", i, producerData.get(i).avgLatency());
}
if (consumerData.size() == 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

    if (consumerData.isEmpty()) {
      if (completed >= records) return State.DONE;
      else return State.RUNNING;
    }

@chia7712 chia7712 merged commit ff1ef2e into opensource4you:main Nov 5, 2021
@chinghongfang chinghongfang deleted the zeroConsumer branch December 20, 2021 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants