From fbfcb959c0eb733187dfd7f252a5ab71e0f38898 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Fri, 15 Mar 2024 20:48:17 +0100 Subject: [PATCH] [overlays] Fix: JOIN / PART events spamming the database Signed-off-by: Knut Ahlers --- internal/apimodules/overlays/overlays.go | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/internal/apimodules/overlays/overlays.go b/internal/apimodules/overlays/overlays.go index 80dc2e0..480291e 100644 --- a/internal/apimodules/overlays/overlays.go +++ b/internal/apimodules/overlays/overlays.go @@ -192,23 +192,21 @@ func Register(args plugins.RegistrationArguments) (err error) { Fields: eventData, } - if msg.EventID, err = addChannelEvent(db, plugins.DeriveChannel(nil, eventData), socketMessage{ - IsLive: false, - Time: time.Now(), - Type: event, - Fields: eventData, - }); err != nil { - return errors.Wrap(err, "storing event") + if !str.StringInSlice(event, storeExemption) { + if msg.EventID, err = addChannelEvent(db, plugins.DeriveChannel(nil, eventData), socketMessage{ + IsLive: false, + Time: time.Now(), + Type: event, + Fields: eventData, + }); err != nil { + return errors.Wrap(err, "storing event") + } } for _, fn := range subscribers { fn(msg) } - if str.StringInSlice(event, storeExemption) { - return nil - } - return nil }); err != nil { return fmt.Errorf("registering event handler: %w", err)