From fa467be11c018b31c5c475a0aaf1c5d50150b3a7 Mon Sep 17 00:00:00 2001 From: Fusl Date: Sat, 5 Mar 2022 17:30:26 +0000 Subject: [PATCH] stats for dupes --- main.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index c710c3e..ba3953c 100644 --- a/main.go +++ b/main.go @@ -182,10 +182,16 @@ func (that *ProjectBackfeedManager) Do() { sAddItems = append(sAddItems, items[i]) } } - if len(sAddItems) == 0 { - continue + dupes := wrapped - len(sAddItems) + if len(sAddItems) != 0 { + err := that.ProjectRedis.SAdd(context.Background(), fmt.Sprintf("%s:todo:backfeed", that.Name), sAddItems...).Err() + if err != nil { + log.Printf("failed to sadd items for %s: %s", that.Name, err) + } + } + if dupes > 0 { + that.BackfeedRedis.HIncrBy(context.Background(), ":", that.Name, int64(dupes)) } - that.ProjectRedis.SAdd(context.Background(), fmt.Sprintf("%s:todo:backfeed", that.Name), sAddItems...) } }