From 6710d892ac0d8f483b0bd7860ec741fde99d0b7d Mon Sep 17 00:00:00 2001 From: nkitlabs Date: Wed, 5 Jun 2024 15:28:46 +0700 Subject: [PATCH] fix lint --- subscriber/subscriber.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/subscriber/subscriber.go b/subscriber/subscriber.go index ebe8ea0..6a7ce74 100644 --- a/subscriber/subscriber.go +++ b/subscriber/subscriber.go @@ -107,7 +107,14 @@ func (s *Subscriber) listenEvents( } s.logger.Debug("New event", "uid: %s", uid) - s.cache.Add(key, struct{}{}, cache.DefaultExpiration) + + // Add the event to the cache, it should never return error due to a new item + // but we log it just in case. + if err := s.cache.Add(key, struct{}{}, cache.DefaultExpiration); err != nil { + s.logger.Error("Failed to add event to cache", "error", err) + continue + } + out <- msg case <-stopCh: break