[overlays] Fix: JOIN / PART events spamming the database

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2024-03-15 20:48:17 +01:00
parent 7f4470e692
commit fbfcb959c0
Signed by: luzifer
SSH key fingerprint: SHA256:/xtE5lCgiRDQr8SLxHMS92ZBlACmATUmF1crK16Ks4E

View file

@ -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)