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

Add tests for deferred completion #125

Merged
merged 2 commits into from
Sep 28, 2021

Conversation

ocadaruma
Copy link
Contributor

@ocadaruma ocadaruma commented Sep 14, 2021

Motivation

  • In Support deferred completion timeout as a workaround for "leak" #99, we made some spec change about ProcessingContext#deferCompletion() that:
    • It requires to re-use Completion instance returned from deferCompletion() if we want to refer it later, otherwise completion will be leaked
    • However we realized that this change could cause a lot of migration cost for Decaton <= 2.x users
      • Decaton doc's example code was also outdated
    • So we concluded to make keep existing deferCompletion-usage to work by adding fix (Leave completion object in ProcessingContext field to avoid leak #124)
    • => We should add integration test cases to ensure it works
  • Besides, I fixed ProcessorTestSuite to await retried-produced tasks to be committed

@ocadaruma ocadaruma marked this pull request as ready for review September 14, 2021 13:44
@ocadaruma ocadaruma requested a review from kawamuray September 14, 2021 13:44
@@ -101,15 +101,15 @@ public void testAsyncTaskCompletion() {
ProcessorTestSuite
.builder(rule)
.configureProcessorsBuilder(builder -> builder.thenProcess((ctx, task) -> {
DeferredCompletion completion = ctx.deferCompletion();
ctx.deferCompletion();
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm +1 for adding test case to check this usage is valid, but IMO we should not advertise this as the primary usage of deferred completion, because unless users require ProcessingContext later in async processing, they should prefer using only Completion so that memory pressure is dramatically reduced?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

they should prefer using only Completion so that memory pressure is dramatically reduced

Good point. I'll revert this and add another test cases with caution.

@ocadaruma ocadaruma requested a review from kawamuray September 28, 2021 04:16
Copy link
Contributor

@kawamuray kawamuray left a comment

Choose a reason for hiding this comment

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

LGTM, thanks 👍

@kawamuray kawamuray merged commit dc12806 into line:master Sep 28, 2021
@ocadaruma ocadaruma deleted the add-test-deferred-completion branch September 28, 2021 06:32
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