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

GH-2742: Exit batch retries when container is paused #2743

Merged
merged 3 commits into from
Jul 16, 2023

Conversation

antonio-tomac
Copy link
Contributor

Closes #2742

Implementation is aligned with idea exit retrying as soon as possible if any of is true:

  • container is not running anymore
  • container is requested to pause
  • retrying batch which has record from partition that container is requested to pause

Why I extracted ?

static Runnable NO_OP = () -> {};
  • To be able to verify arguments
  • Named field stating intention

Why did I introduced new method?

public static void stoppableSleep(Supplier<Boolean> shouldSleepCondition, long interval) throws InterruptedException
  • At first it was tempting just to add !container.isRunning() || container.isPauseRequested() but not having access to retrying ConsumerRecords to check paused partitions
  • Changing behaviour of public api seems like bad idea, and I believe banned for patch (or even minor) versions

Regarding execution duration assertions

  • Initially, I wrote something like
    assertThat(duration).isBetween(100L, 150L);
  • But, such assertions could become flaky tests when asking sleep for "precise" timing

@garyrussell garyrussell merged commit b5506ee into spring-projects:main Jul 16, 2023
2 checks passed
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.

FallbackBatchErrorHandler - Consider Seeking and Exiting Retries When Container is Paused
2 participants