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

client/batch: allow tokenCh of batch controller to be nil #8903

Merged
merged 2 commits into from
Dec 17, 2024

Conversation

JmPotato
Copy link
Member

What problem does this PR solve?

Issue Number: ref #8690.

What is changed and how does it work?

Allow `tokenCh` of batch controller be nil.

Check List

Tests

  • Unit test
  • Integration test

Release note

None.

@JmPotato JmPotato added the component/client Client logic. label Dec 11, 2024
@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. dco-signoff: yes Indicates the PR's author has signed the dco. labels Dec 11, 2024
@JmPotato
Copy link
Member Author

/cc @MyonKeminta

Copy link
Contributor

ti-chi-bot bot commented Dec 11, 2024

@JmPotato: GitHub didn't allow me to request PR reviews from the following users: MyonKeminta.

Note that only tikv members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

/cc @MyonKeminta

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@ti-chi-bot ti-chi-bot bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Dec 11, 2024
Copy link

codecov bot commented Dec 11, 2024

Codecov Report

Attention: Patch coverage is 81.25000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 76.25%. Comparing base (5d62787) to head (6289eef).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #8903   +/-   ##
=======================================
  Coverage   76.25%   76.25%           
=======================================
  Files         461      461           
  Lines       70395    70399    +4     
=======================================
+ Hits        53677    53685    +8     
+ Misses      13372    13365    -7     
- Partials     3346     3349    +3     
Flag Coverage Δ
unittests 76.25% <81.25%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Copy link
Contributor

@MyonKeminta MyonKeminta left a comment

Choose a reason for hiding this comment

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

Rest LGTM

client/pkg/batch/batch_controller.go Outdated Show resolved Hide resolved
client/pkg/batch/batch_controller.go Show resolved Hide resolved
Signed-off-by: JmPotato <[email protected]>
@JmPotato JmPotato changed the title client/batch: allow tokenCh of batch controller be nil client/batch: allow tokenCh of batch controller to be nil Dec 12, 2024
Copy link
Contributor

ti-chi-bot bot commented Dec 12, 2024

@MyonKeminta: adding LGTM is restricted to approvers and reviewers in OWNERS files.

In response to this:

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Dec 12, 2024
@@ -60,13 +60,18 @@ func NewController[T any](maxBatchSize int, finisher FinisherFunc[T], bestBatchO
// It returns nil error if everything goes well, otherwise a non-nil error which means we should stop the service.
// It's guaranteed that if this function failed after collecting some requests, then these requests will be cancelled
// when the function returns, so the caller don't need to clear them manually.
// `tokenCh` is an optional parameter:
Copy link
Member

Choose a reason for hiding this comment

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

Shall we use something like

FetchPendingRequests(ctx context.Context, requestCh <-chan T, maxBatchWaitInterval time.Duration, tokenCh ...chan struct{}) (errRet error) {

Copy link
Member Author

Choose a reason for hiding this comment

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

It looks good to me, but I prefer keeping the current way to force the caller to decide whether tokenCh is needed by explicitly passing it in.

@JmPotato JmPotato requested a review from rleungx December 13, 2024 05:10
@ti-chi-bot ti-chi-bot bot added the lgtm label Dec 17, 2024
Copy link
Contributor

ti-chi-bot bot commented Dec 17, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: MyonKeminta, nolouch, rleungx

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot removed the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Dec 17, 2024
Copy link
Contributor

ti-chi-bot bot commented Dec 17, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-12-12 09:44:06.463782742 +0000 UTC m=+518036.552585285: ☑️ agreed by nolouch.
  • 2024-12-17 06:45:21.539148256 +0000 UTC m=+939311.627950799: ☑️ agreed by rleungx.

@ti-chi-bot ti-chi-bot bot merged commit e8bef5f into tikv:master Dec 17, 2024
25 checks passed
@JmPotato JmPotato deleted the nil_tokenCh branch December 17, 2024 06:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved component/client Client logic. dco-signoff: yes Indicates the PR's author has signed the dco. lgtm release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants