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

ConsumeTimestamp选项无法设置,导致ConsumeFromTimestamp没有意义 #685

Closed
happylhb opened this issue Jun 19, 2021 · 1 comment · Fixed by #682
Closed

ConsumeTimestamp选项无法设置,导致ConsumeFromTimestamp没有意义 #685

happylhb opened this issue Jun 19, 2021 · 1 comment · Fixed by #682
Labels
help wanted Extra attention is needed

Comments

@happylhb
Copy link

consumer.WithConsumeFromWhere(consumer.ConsumeFromTimestamp) 但无法设置ConsumeTimestamp
通过代码来看,也没有计算最近半小时的选择

//consumer/consumer.go  line:784

case ConsumeFromTimestamp:
	if lastOffset == -1 {
		if strings.HasPrefix(mq.Topic, internal.RetryGroupTopicPrefix) {
			lastOffset, err := dc.queryMaxOffset(mq)
			if err == nil {
				result = lastOffset
			} else {
				result = -1
				rlog.Warning("query max offset error", map[string]interface{}{
					rlog.LogKeyMessageQueue:  mq,
					rlog.LogKeyUnderlayError: err,
				})
			}
		} else {
			t, err := time.Parse("20060102150405", dc.option.ConsumeTimestamp)
			if err != nil {
				result = -1
			} else {
				lastOffset, err := dc.searchOffsetByTimestamp(mq, t.Unix()*1000)
				if err != nil {
					result = -1
				} else {
					result = lastOffset
				}
			}
		}
	}
default:
@maixiaohai
Copy link
Contributor

try this #681
you can set consumer offset by timestamp through console

@wenfengwang wenfengwang added the help wanted Extra attention is needed label Jul 1, 2021
@wenfengwang wenfengwang linked a pull request Jul 2, 2021 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants