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

Calling Stop on a stopped consumer blocks #29

Open
Sytten opened this issue Jun 27, 2019 · 3 comments
Open

Calling Stop on a stopped consumer blocks #29

Sytten opened this issue Jun 27, 2019 · 3 comments

Comments

@Sytten
Copy link
Contributor

Sytten commented Jun 27, 2019

The title says pretty much all. The fix is not obvious though since it is using a blocking channel internally.

@garethlewin
Copy link
Contributor

Kinsumer is designed to be called from a single go routine, so you shouldn't have to call Stop() on a stopped consumer. That said, can you describe your use case some more, maybe I can update the library to handle your use case.

@Sytten
Copy link
Contributor Author

Sytten commented Jun 27, 2019

The lib doesn't accept a Context, so it is somewhat hard to do a graceful shutdown. I ended up doing this:

go func() {
		select {
		case <-ctx.Done():
			k.Stop()
		}
	}()

But I also had a defer k.Stop() and it was blocking the shutdown.

@Sytten
Copy link
Contributor Author

Sytten commented Jul 1, 2019

I guess the best way to fix this problem would be to accept a context so we can cancel the job.

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

2 participants