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

Configurable wait delay in the random string source #3602

Merged

Conversation

dlvenable
Copy link
Member

@dlvenable dlvenable commented Nov 8, 2023

Description

Adds the wait_delay configuration to the random source. Also, uses a single thread rather than an executor and increases test coverage in that class.

Issues Resolved

Resolves #3601

Check List

  • New functionality includes testing.
  • New functionality has a documentation issue. Please link to it in this PR.
    • New functionality has javadoc added
  • Commits are signed with a real name per the DCO

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

…t delay between writes to the buffer. Resolves opensearch-project#3595. Also uses a single thread for this source to avoid an unnecessary thread pool and increases the code coverage.

Signed-off-by: David Venable <[email protected]>
}

@Override
public void start(final Buffer<Record<Event>> buffer) {
setExecutorService();
executorService.execute(() -> {
if(thread != null) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: space after if

throw new IllegalStateException("This source has already started.");
}

thread = new Thread(() -> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

QUES: what is the benefit of this change?

Copy link
Member Author

Choose a reason for hiding this comment

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

The current code doesn't need a threat pool because it runs one thread. Taking this approach simplifies some of the branching in the code, making it easier to get higher test coverage.

@dlvenable dlvenable merged commit 88e0bb0 into opensearch-project:main Nov 14, 2023
42 checks passed
@dlvenable dlvenable deleted the 3601-random-source-wait-delay branch March 6, 2024 16:49
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.

Configure the delay in the random string source
3 participants