Skip to content

Commit

Permalink
fix: copy value before adding as tag
Browse files Browse the repository at this point in the history
  • Loading branch information
rucciva committed Aug 29, 2023
1 parent 7c0d6f9 commit e7a1afd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,14 +193,18 @@ func parseTime(lineNum *string) (t time.Time, err error) {
func (s *Logstream) SavePositition() (err error) {
tags := map[string]string{}
for k, v := range s.stream.Tag {
if strings.HasPrefix(k, "_") || k == streamExclusionTag {
continue
}
tags[k] = v
}
pos := strconv.FormatInt(s.last.UnixNano(), 10)
tags[streamPosTag] = pos

tagsb := []model.TagsBody{}
for k, v := range tags {
tagsb = append(tagsb, model.TagsBody{Key: &k, Value: &v})
key, value := k, v
tagsb = append(tagsb, model.TagsBody{Key: &key, Value: &value})
}
_, err = s.client.CreateTags(&model.CreateTagsRequest{
ResourceType: "topics",
Expand Down

0 comments on commit e7a1afd

Please sign in to comment.