applying this pattern to all function arguments

1. context
2. config (if any)
3. channel it reads from
...
N. (last) the forward function
This commit is contained in:
pippellia-btc
2025-09-19 16:15:02 +02:00
parent 815e79282f
commit 8ff738ce09
5 changed files with 16 additions and 16 deletions

View File

@@ -16,8 +16,8 @@ import (
func Recorder(
ctx context.Context,
db redb.RedisDB,
events <-chan *nostr.Event,
db redb.RedisDB,
forward Forward[*nostr.Event],
) {
log.Println("Recorder: ready")
@@ -35,7 +35,7 @@ func Recorder(
return
}
err := recordEvent(ctx, db, event)
err := recordEvent(ctx, event, db)
if err != nil && ctx.Err() == nil {
log.Printf("Recorder: %v", err)
}
@@ -84,7 +84,7 @@ func events(day string, k int) string { return KeyEvents + separator + day + se
// - add event.ID to the events:<today>:kind:<event.Kind>
// - add pubkey to the active_pubkeys:<today>
// - add pubkey to the creator_pubkeys:<today> if event is in [contentKinds]
func recordEvent(ctx context.Context, db redb.RedisDB, event *nostr.Event) error {
func recordEvent(ctx context.Context, event *nostr.Event, db redb.RedisDB) error {
ctx, cancel := context.WithTimeout(ctx, time.Second)
defer cancel()