+2
-1
automod/cachestore/cachestore_redis.go
+2
-1
automod/cachestore/cachestore_redis.go
···
16
16
var _ CacheStore = (*RedisCacheStore)(nil)
17
17
18
18
func NewRedisCacheStore(redisURL string, ttl time.Duration) (*RedisCacheStore, error) {
19
+
ctx := context.Background()
19
20
opt, err := redis.ParseURL(redisURL)
20
21
if err != nil {
21
22
return nil, err
22
23
}
23
24
rdb := redis.NewClient(opt)
24
25
// check redis connection
25
-
_, err = rdb.Ping(context.TODO()).Result()
26
+
_, err = rdb.Ping(ctx).Result()
26
27
if err != nil {
27
28
return nil, err
28
29
}
+2
-1
automod/countstore/countstore_redis.go
+2
-1
automod/countstore/countstore_redis.go
···
15
15
}
16
16
17
17
func NewRedisCountStore(redisURL string) (*RedisCountStore, error) {
18
+
ctx := context.Background()
18
19
opt, err := redis.ParseURL(redisURL)
19
20
if err != nil {
20
21
return nil, err
21
22
}
22
23
rdb := redis.NewClient(opt)
23
24
// check redis connection
24
-
_, err = rdb.Ping(context.TODO()).Result()
25
+
_, err = rdb.Ping(ctx).Result()
25
26
if err != nil {
26
27
return nil, err
27
28
}
+2
-1
automod/flagstore/flagstore_redis.go
+2
-1
automod/flagstore/flagstore_redis.go
···
13
13
}
14
14
15
15
func NewRedisFlagStore(redisURL string) (*RedisFlagStore, error) {
16
+
ctx := context.Background()
16
17
opt, err := redis.ParseURL(redisURL)
17
18
if err != nil {
18
19
return nil, err
19
20
}
20
21
rdb := redis.NewClient(opt)
21
22
// check redis connection
22
-
_, err = rdb.Ping(context.TODO()).Result()
23
+
_, err = rdb.Ping(ctx).Result()
23
24
if err != nil {
24
25
return nil, err
25
26
}
+1
-4
automod/rules/misleading.go
+1
-4
automod/rules/misleading.go
···
1
1
package rules
2
2
3
3
import (
4
-
"context"
5
4
"log/slog"
6
5
"net/url"
7
6
"strings"
···
106
105
var _ automod.PostRuleFunc = MisleadingMentionPostRule
107
106
108
107
func MisleadingMentionPostRule(c *automod.RecordContext, post *appbsky.FeedPost) error {
109
-
// TODO: do we really need to route context around? probably
110
-
ctx := context.TODO()
111
108
facets, err := ExtractFacets(post)
112
109
if err != nil {
113
110
c.Logger.Warn("invalid facets", "err", err)
···
127
124
continue
128
125
}
129
126
130
-
mentioned, err := c.Directory().LookupHandle(ctx, handle)
127
+
mentioned, err := c.Directory().LookupHandle(c.Ctx, handle)
131
128
if err != nil {
132
129
c.Logger.Warn("could not resolve handle", "handle", handle)
133
130
c.AddRecordFlag("broken-mention")
+1
-3
cmd/hepa/consumer.go
+1
-3
cmd/hepa/consumer.go
···
25
25
26
26
func (s *Server) RunConsumer(ctx context.Context) error {
27
27
28
-
// TODO: persist cursor in a database or local disk
29
28
cur, err := s.ReadLastCursor(ctx)
30
29
if err != nil {
31
30
return err
···
89
88
}
90
89
return nil
91
90
},
92
-
// TODO: other event callbacks as needed
93
91
}
94
92
95
93
var scheduler events.Scheduler
···
220
218
continue
221
219
}
222
220
default:
223
-
// TODO: other event types: update, delete
221
+
// TODO: should this be an error?
224
222
}
225
223
}
226
224