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

Dropped items #1

Open
blanchg opened this issue Sep 14, 2022 · 0 comments
Open

Dropped items #1

blanchg opened this issue Sep 14, 2022 · 0 comments

Comments

@blanchg
Copy link

blanchg commented Sep 14, 2022

I realize this is 4-5 years old but for anyone that follows.

Items that are added while a batch is executing the callback function due to timer will be silently dropped.

This is because the callback function called by the timer isn't safeguarded by the mutex. To fix

modify the timer handler in the run() func

case <-timer.C:
	bc.mutex.Lock()
	defer bc.mutex.Unlock()
	bc.callback(batch)
	if bc.input != nil {
		close(bc.input)
		bc.input = nil
	}
	return

Thanks!

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

No branches or pull requests

1 participant