[core] Fix: Notify event handlers before rules to prevent delays

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2022-05-02 00:12:57 +02:00
parent 967e301390
commit 40fb93962c
Signed by: luzifer
GPG key ID: 0066F03ED215AD7D

View file

@ -66,6 +66,11 @@ func triggerAction(c *irc.Client, m *irc.Message, rule *plugins.Rule, ra *plugin
}
func handleMessage(c *irc.Client, m *irc.Message, event *string, eventData *plugins.FieldCollection) {
// Send events to registered handlers
if event != nil {
go notifyEventHandlers(*event, eventData)
}
for _, r := range config.GetMatchingRules(m, event, eventData) {
var preventCooldown bool
@ -83,9 +88,4 @@ func handleMessage(c *irc.Client, m *irc.Message, event *string, eventData *plug
r.SetCooldown(timerStore, m, eventData)
}
}
// Send events to registered handlers
if event != nil {
notifyEventHandlers(*event, eventData)
}
}