diff --git a/domain/events.go b/domain/events.go index d82aa95..af6577c 100644 --- a/domain/events.go +++ b/domain/events.go @@ -289,7 +289,7 @@ type AlertEvent struct { Event *protocol.AlertEvent Logs []LogEntry Timestamps *TrackingTimestamps - Subscriber *Subscriber + Subscriber Subscriber } // ToMessage converts the AlertEvent to the protocol.TransactionEvent message diff --git a/feeds/combiner.go b/feeds/combiner.go index f6db4f5..6ea2167 100644 --- a/feeds/combiner.go +++ b/feeds/combiner.go @@ -238,7 +238,7 @@ func (cf *combinerFeed) handleSubscriptions(alertHandlers []cfHandler, subscript break } } - cf.processAlerts(cf.ctx, logger, &subscriber, subscriberAlerts, alertHandlers) + cf.processAlerts(cf.ctx, logger, subscriber, subscriberAlerts, alertHandlers) } } @@ -293,7 +293,7 @@ func subscriptionsToAlertInputs(subscriptions []*protocol.CombinerBotSubscriptio // the remaining alerts to the alert handlers passed in as an argument. // It uses a cache to prevent duplicate processing of alerts and creates an AlertEvent object to pass to each alert handler. // It is thread-safe as it acquires a lock on the combinerCache mutex before accessing or modifying it. -func (cf *combinerFeed) processAlerts(_ context.Context, logger *log.Entry, subscriber *domain.Subscriber, +func (cf *combinerFeed) processAlerts(_ context.Context, logger *log.Entry, subscriber domain.Subscriber, alerts []*protocol.AlertEvent, alertHandlers []cfHandler) { for _, alert := range alerts { diff --git a/feeds/combiner_cache.go b/feeds/combiner_cache.go index efc79b3..e28672d 100644 --- a/feeds/combiner_cache.go +++ b/feeds/combiner_cache.go @@ -53,12 +53,12 @@ func newCombinerCache(path string) (*combinerCache, error) { return &combinerCache{cache: alertCache, path: path}, nil } -func (c *combinerCache) Exists(subscriber *domain.Subscriber, alert *protocol.AlertEvent) bool { +func (c *combinerCache) Exists(subscriber domain.Subscriber, alert *protocol.AlertEvent) bool { _, exists := c.cache.Get(encodeAlertCacheKey(subscriber.BotID, subscriber.BotImage, alert.Alert.Hash)) return exists } -func (c *combinerCache) Set(subscriber *domain.Subscriber, alert *protocol.AlertEvent) { +func (c *combinerCache) Set(subscriber domain.Subscriber, alert *protocol.AlertEvent) { c.cache.Set(encodeAlertCacheKey(subscriber.BotID, subscriber.BotImage, alert.Alert.Hash), struct{}{}, cache.DefaultExpiration) }