From 2efab0519da47cedbd080093b638c980c8f0e2cd Mon Sep 17 00:00:00 2001 From: bryan newbold Date: Thu, 14 Nov 2024 21:48:54 +0000 Subject: [PATCH] ident: have redis caching dir only log on 'write', not error --- atproto/identity/redisdir/redis_directory.go | 46 +++++++++++++------- 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/atproto/identity/redisdir/redis_directory.go b/atproto/identity/redisdir/redis_directory.go index f1d67f256..49186d433 100644 --- a/atproto/identity/redisdir/redis_directory.go +++ b/atproto/identity/redisdir/redis_directory.go @@ -4,6 +4,7 @@ import ( "context" "errors" "fmt" + "log/slog" "sync" "time" @@ -116,9 +117,12 @@ func (d *RedisDirectory) updateHandle(ctx context.Context, h syntax.Handle) hand TTL: d.ErrTTL, }) if err != nil { - he.DID = nil - he.Err = fmt.Errorf("identity cache write: %w", err) - return he + /* + he.DID = nil + he.Err = fmt.Errorf("identity cache write: %w", err) + return he + */ + slog.Error("identity cache write", "cache", "handle", "err", err) } return he } @@ -141,9 +145,12 @@ func (d *RedisDirectory) updateHandle(ctx context.Context, h syntax.Handle) hand TTL: d.HitTTL, }) if err != nil { - he.DID = nil - he.Err = fmt.Errorf("identity cache write: %w", err) - return he + /* + he.DID = nil + he.Err = fmt.Errorf("identity cache write: %w", err) + return he + */ + slog.Error("identity cache write", "cache", "did", "did", ident.DID, "err", err) } err = d.handleCache.Set(&cache.Item{ Ctx: ctx, @@ -152,9 +159,12 @@ func (d *RedisDirectory) updateHandle(ctx context.Context, h syntax.Handle) hand TTL: d.HitTTL, }) if err != nil { - he.DID = nil - he.Err = fmt.Errorf("identity cache write: %w", err) - return he + /* + he.DID = nil + he.Err = fmt.Errorf("identity cache write: %w", err) + return he + */ + slog.Error("identity cache write", "cache", "handle", "did", ident.DID, "err", err) } return he } @@ -250,9 +260,12 @@ func (d *RedisDirectory) updateDID(ctx context.Context, did syntax.DID) identity TTL: d.HitTTL, }) if err != nil { - entry.Identity = nil - entry.Err = fmt.Errorf("identity cache write: %v", err) - return entry + /* + entry.Identity = nil + entry.Err = fmt.Errorf("identity cache write: %v", err) + return entry + */ + slog.Error("identity cache write", "cache", "did", "did", did, "err", err) } if he != nil { err = d.handleCache.Set(&cache.Item{ @@ -262,9 +275,12 @@ func (d *RedisDirectory) updateDID(ctx context.Context, did syntax.DID) identity TTL: d.HitTTL, }) if err != nil { - entry.Identity = nil - entry.Err = fmt.Errorf("identity cache write: %v", err) - return entry + /* + entry.Identity = nil + entry.Err = fmt.Errorf("identity cache write: %v", err) + return entry + */ + slog.Error("identity cache write", "cache", "handle", "did", did, "err", err) } } return entry