···
func unmarkActorForLikes(sid string, did syntax.DID) {
if ud, exists := actorData.Get(did); exists {
113
+
// remove actor data if no subscribers are attached to it
114
+
if ud.targets.Len() == 0 {
···
logger.Error("like record not found", "rkey", rkey)
302
-
if err := json.Unmarshal(event.Commit.Record, &like); err != nil {
303
-
logger.Error("failed to unmarshal like", "error", err)
305
+
} else if err := unmarshalEvent(event, &like); err != nil {
// if there is no via it means its not a repost anyway
···
332
-
if ud.profile == nil || time.Now().Sub(ud.profileFetchedAt) > time.Hour*24 {
333
+
if ud.profile == nil || time.Since(ud.profileFetchedAt) > time.Hour*24 {
profile, err := fetchProfile(ctx, byDid)
logger.Error("cant fetch profile", "error", err)
···
byDid := syntax.DID(event.Did)
ud, exists := actorData.Get(byDid)
369
+
if !exists || ud.targets.Len() == 0 {
···
if f, exists := ud.follows.Get(rkey); exists {
382
-
logger.Error("follow record not found", "rkey", rkey)
383
+
// most likely no ListenTypeFollows subscriber attached on actor
384
+
logger.Warn("follow record not found", "rkey", rkey, "actor", byDid)
if err := unmarshalEvent(event, &r); err != nil {
388
-
logger.Error("could not unmarshal follow event", "error", err)
ud.follows.Insert(rkey, r)
ud.targets.Range(func(sid string, sd *SubscriberData) bool {
// if we arent managing then we dont need to update anything
if sd.listenType != ListenTypeFollows {
···
func unmarshalEvent[v any](event *models.Event, val *v) error {
if err := json.Unmarshal(event.Commit.Record, val); err != nil {
415
-
logger.Error("failed to unmarshal", "error", err, "raw", event.Commit.Record)
417
+
logger.Error("cant unmarshal record", "error", err, "raw", event.Commit.Record)