From c33d3b275f2580bff2d510715448c14be1d5d5b5 Mon Sep 17 00:00:00 2001 From: SayaAndy Date: Sat, 30 Aug 2025 13:58:46 +0700 Subject: fix: truncate likes table prior to dumping cache --- internal/router/client-cache.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'internal') diff --git a/internal/router/client-cache.go b/internal/router/client-cache.go index 56cd595..b930d5a 100644 --- a/internal/router/client-cache.go +++ b/internal/router/client-cache.go @@ -76,6 +76,11 @@ func (c *ClientCache) Close() error { return fmt.Errorf("fail to init transaction with db to dump cache: %w", err) } + if _, err = tx.Exec("delete from blog_likes;"); err != nil { + tx.Rollback() + return fmt.Errorf("fail to truncate table blog_likes: %w", err) + } + userIdBytes := make(map[string][]byte) sqlStatement := fmt.Sprintf(` -- cgit v1.3.1+13