diff options
author | Neil Alexander <neilalexander@users.noreply.github.com> | 2022-01-28 12:33:31 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-28 12:33:31 +0000 |
commit | e9fbad6f2015ac0375eff76c8d50962791099e17 (patch) | |
tree | 579c9dbe4828a6d0c7b14c806285b4e8d9dcfde6 /roomserver | |
parent | 2ea5fd41623e22cd2a00c59e7954950037bfa8bb (diff) |
Move hook call when processing room events (#2118)
* Move hook call when processing room events
* Fix build
Diffstat (limited to 'roomserver')
-rw-r--r-- | roomserver/internal/input/input.go | 5 | ||||
-rw-r--r-- | roomserver/internal/input/input_events.go | 5 |
2 files changed, 4 insertions, 6 deletions
diff --git a/roomserver/internal/input/input.go b/roomserver/internal/input/input.go index e0ddd07c..e6f325b4 100644 --- a/roomserver/internal/input/input.go +++ b/roomserver/internal/input/input.go @@ -25,7 +25,6 @@ import ( "github.com/Arceliar/phony" "github.com/getsentry/sentry-go" fedapi "github.com/matrix-org/dendrite/federationapi/api" - "github.com/matrix-org/dendrite/internal/hooks" "github.com/matrix-org/dendrite/roomserver/acls" "github.com/matrix-org/dendrite/roomserver/api" "github.com/matrix-org/dendrite/roomserver/internal/query" @@ -105,8 +104,6 @@ func (r *Inputer) Start() error { if !errors.Is(err, context.DeadlineExceeded) && !errors.Is(err, context.Canceled) { sentry.CaptureException(err) } - } else { - go hooks.Run(hooks.KindNewEventPersisted, inputRoomEvent.Event) } _ = msg.Ack() }) @@ -176,8 +173,6 @@ func (r *Inputer) InputRoomEvents( if !errors.Is(err, context.DeadlineExceeded) && !errors.Is(err, context.Canceled) { sentry.CaptureException(err) } - } else { - go hooks.Run(hooks.KindNewEventPersisted, inputRoomEvent.Event) } select { case <-ctx.Done(): diff --git a/roomserver/internal/input/input_events.go b/roomserver/internal/input/input_events.go index 5f911522..33442140 100644 --- a/roomserver/internal/input/input_events.go +++ b/roomserver/internal/input/input_events.go @@ -25,6 +25,7 @@ import ( fedapi "github.com/matrix-org/dendrite/federationapi/api" "github.com/matrix-org/dendrite/internal" "github.com/matrix-org/dendrite/internal/eventutil" + "github.com/matrix-org/dendrite/internal/hooks" "github.com/matrix-org/dendrite/roomserver/api" "github.com/matrix-org/dendrite/roomserver/internal/helpers" "github.com/matrix-org/dendrite/roomserver/state" @@ -321,7 +322,9 @@ func (r *Inputer) processRoomEvent( } } - // Update the extremities of the event graph for the room + // Everything was OK — the latest events updater didn't error and + // we've sent output events. Finally, generate a hook call. + hooks.Run(hooks.KindNewEventPersisted, headered) return nil } |