diff --git a/automod/cachestore/cachestore_redis.go b/automod/cachestore/cachestore_redis.go index 26b1aacb..3872dc44 100644 --- a/automod/cachestore/cachestore_redis.go +++ b/automod/cachestore/cachestore_redis.go @@ -16,13 +16,14 @@ type RedisCacheStore struct { var _ CacheStore = (*RedisCacheStore)(nil) func NewRedisCacheStore(redisURL string, ttl time.Duration) (*RedisCacheStore, error) { + ctx := context.Background() opt, err := redis.ParseURL(redisURL) if err != nil { return nil, err } rdb := redis.NewClient(opt) // check redis connection - _, err = rdb.Ping(context.TODO()).Result() + _, err = rdb.Ping(ctx).Result() if err != nil { return nil, err } diff --git a/automod/countstore/countstore_redis.go b/automod/countstore/countstore_redis.go index bd7d5f21..2e42c96f 100644 --- a/automod/countstore/countstore_redis.go +++ b/automod/countstore/countstore_redis.go @@ -15,13 +15,14 @@ type RedisCountStore struct { } func NewRedisCountStore(redisURL string) (*RedisCountStore, error) { + ctx := context.Background() opt, err := redis.ParseURL(redisURL) if err != nil { return nil, err } rdb := redis.NewClient(opt) // check redis connection - _, err = rdb.Ping(context.TODO()).Result() + _, err = rdb.Ping(ctx).Result() if err != nil { return nil, err } diff --git a/automod/flagstore/flagstore_redis.go b/automod/flagstore/flagstore_redis.go index 33bbe51d..ac1ee111 100644 --- a/automod/flagstore/flagstore_redis.go +++ b/automod/flagstore/flagstore_redis.go @@ -13,13 +13,14 @@ type RedisFlagStore struct { } func NewRedisFlagStore(redisURL string) (*RedisFlagStore, error) { + ctx := context.Background() opt, err := redis.ParseURL(redisURL) if err != nil { return nil, err } rdb := redis.NewClient(opt) // check redis connection - _, err = rdb.Ping(context.TODO()).Result() + _, err = rdb.Ping(ctx).Result() if err != nil { return nil, err } diff --git a/automod/rules/misleading.go b/automod/rules/misleading.go index bc69ba7d..df4525cf 100644 --- a/automod/rules/misleading.go +++ b/automod/rules/misleading.go @@ -1,7 +1,6 @@ package rules import ( - "context" "log/slog" "net/url" "strings" @@ -106,8 +105,6 @@ func MisleadingURLPostRule(c *automod.RecordContext, post *appbsky.FeedPost) err var _ automod.PostRuleFunc = MisleadingMentionPostRule func MisleadingMentionPostRule(c *automod.RecordContext, post *appbsky.FeedPost) error { - // TODO: do we really need to route context around? probably - ctx := context.TODO() facets, err := ExtractFacets(post) if err != nil { c.Logger.Warn("invalid facets", "err", err) @@ -127,7 +124,7 @@ func MisleadingMentionPostRule(c *automod.RecordContext, post *appbsky.FeedPost) continue } - mentioned, err := c.Directory().LookupHandle(ctx, handle) + mentioned, err := c.Directory().LookupHandle(c.Ctx, handle) if err != nil { c.Logger.Warn("could not resolve handle", "handle", handle) c.AddRecordFlag("broken-mention") diff --git a/cmd/hepa/consumer.go b/cmd/hepa/consumer.go index 312ade95..3577fad3 100644 --- a/cmd/hepa/consumer.go +++ b/cmd/hepa/consumer.go @@ -25,7 +25,6 @@ import ( func (s *Server) RunConsumer(ctx context.Context) error { - // TODO: persist cursor in a database or local disk cur, err := s.ReadLastCursor(ctx) if err != nil { return err @@ -89,7 +88,6 @@ func (s *Server) RunConsumer(ctx context.Context) error { } return nil }, - // TODO: other event callbacks as needed } var scheduler events.Scheduler @@ -220,7 +218,7 @@ func (s *Server) HandleRepoCommit(ctx context.Context, evt *comatproto.SyncSubsc continue } default: - // TODO: other event types: update, delete + // TODO: should this be an error? } }