Skip to content

feat: Add WaitWithTimeout to Partition and WaitGroupTimeout #26294

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

Draft
wants to merge 8 commits into
base: master-1.x
Choose a base branch
from

Conversation

devanbenz
Copy link

This PR makes it easier to debug potential hanging retention service routines during DeleteShard.

This PR makes it easier to debug potential hanging retention service
routines during DeleteShard.
func WaitGroupTimeout(wg *sync.WaitGroup, timeout time.Duration) bool {
c := make(chan struct{})

go func() {
Copy link
Contributor

Choose a reason for hiding this comment

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

take unidirectional channel as parameter

case <-c:
return false
case <-timer.C:
return true
Copy link
Contributor

Choose a reason for hiding this comment

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

Log here, but do not exit.

"time"
)

func WaitGroupTimeout(wg *sync.WaitGroup, timeout time.Duration) bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

I would take a zap.Logger and a message here. Print the message at Warn level each time around the loop, with the total elapsed duration as a zap field. No return value - make this like Wait

I would not return on timer ticks; that will change the behavior of the system. Just log the wait.

Style suggestion: take c as an argument to the lambda, restricting its directionality, and renaming it.

Copy link
Contributor

@davidby-influx davidby-influx left a comment

Choose a reason for hiding this comment

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

In line comments

@devanbenz devanbenz changed the title feat: Add WaitWithTimeout to Partition feat: Add WaitWithTimeout to Partition and WaitGroupTimeout Apr 18, 2025
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