this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix the map initialization

+7 -6
+7 -6
consumer.go
··· 38 38 h := &handler{ 39 39 seenSeqs: make(map[int64]struct{}), 40 40 feedGenerator: feedGen, 41 - parentsToLookFor: make(map[string]struct{}), 41 + parentsToLookFor: make(map[string]map[string]struct{}), 42 42 } 43 43 44 44 scheduler := sequential.NewScheduler("jetstream_localdev", logger, h.HandleEvent) ··· 85 85 return nil 86 86 } 87 87 88 + parentURI := post.Reply.Parent.Uri 89 + 88 90 // look for posts where I've "subsribed" so that we can add the parent URI to a list of replies to that parent to look for 89 91 if strings.Contains(post.Text, "/subscribe") && event.Did == "did:plc:dadhhalkfcq3gucaq25hjqon" { 90 - slog.Info("a post that's subscribing to a parent. Adding to parents to look for", "parent URI", post.Reply.Parent.Uri) 91 - // h.parentsToLookFor[post.Reply.Parent.Uri] = struct{}{} 92 - h.addDidToSubscribedParent(post.Reply.Parent.Uri, event.Did) 92 + slog.Info("a post that's subscribing to a parent. Adding to parents to look for", "parent URI", parentURI) 93 + h.addDidToSubscribedParent(parentURI, event.Did) 93 94 return nil 94 95 } 95 96 96 97 // see if the post is a reply to a post we are subscribed to 97 - subscribedDids := h.getSubscribedDidsForParent(post.Reply.Parent.Uri) 98 + subscribedDids := h.getSubscribedDidsForParent(parentURI) 98 99 if len(subscribedDids) == 0 { 99 100 return nil 100 101 } 101 102 102 - slog.Info("post is a reply to a parent that users are subscribed to", "parent URI", post.Reply.Parent.Uri, "dids", subscribedDids, "RKey", event.Commit.RKey) 103 + slog.Info("post is a reply to a parent that users are subscribed to", "parent URI", parentURI, "dids", subscribedDids, "RKey", event.Commit.RKey) 103 104 104 105 h.feedGenerator.AddToFeedPosts(subscribedDids, fmt.Sprintf("at://%s/app.bsky.feed.post/%s", event.Did, event.Commit.RKey)) 105 106 }