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

issue: the ctx not work for consumer.PullFrom method #1131

Open
zl03jsj opened this issue Mar 8, 2024 · 0 comments · May be fixed by #1132
Open

issue: the ctx not work for consumer.PullFrom method #1131

zl03jsj opened this issue Mar 8, 2024 · 0 comments · May be fixed by #1132

Comments

@zl03jsj
Copy link

zl03jsj commented Mar 8, 2024

The context not work in consumer.PullFrom method:

	c, err := consumer2.NewPullConsumer(
		consumer2.WithNameServer([]string{cfg.NameSvr}),
		consumer2.WithGroupName(consumerGroupName),
		consumer2.WithConsumeFromWhere(consumer2.ConsumeFromLastOffset),
		consumer2.WithConsumerOrder(true),
		consumer2.WithRetry(1),
	)
	ctx, _ = context.WithTimeout(context.Background(), time.Second)

	result, err := c.PullFrom(ctx, mq, offset, maxPullCount)

even if the ctx is timeout, or was canceled(if message queue have no new message) manually, it will still block for 30 seconds.

@zl03jsj zl03jsj changed the title issue: the ctx won't work for consumer.PullFrom method issue: the ctx not work for consumer.PullFrom method Mar 8, 2024
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 a pull request may close this issue.

1 participant