From ea7fd6c845e8e604627a61e75c5ec52926925033 Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Mon, 27 Feb 2017 09:35:20 +0000 Subject: [PATCH] Comment on why event sending is synchronous --- .../matrix-org/dendrite/roomserver/input/latest_events.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/github.com/matrix-org/dendrite/roomserver/input/latest_events.go b/src/github.com/matrix-org/dendrite/roomserver/input/latest_events.go index bb8748c26..d04e4be9d 100644 --- a/src/github.com/matrix-org/dendrite/roomserver/input/latest_events.go +++ b/src/github.com/matrix-org/dendrite/roomserver/input/latest_events.go @@ -7,7 +7,8 @@ import ( "github.com/matrix-org/gomatrixserverlib" ) -// updateLatestEvents updates the list of latest events for this room. +// updateLatestEvents updates the list of latest events for this room in the database and writes the +// event to the output log. // The latest events are the events that aren't referenced by another event in the database: // // Time goes down the page. 1 is the m.room.create event (root). @@ -79,6 +80,10 @@ func doUpdateLatestEvents( // Send the event to the output logs. // We do this inside the database transaction to ensure that we only mark an event as sent if we sent it. + // TODO: This assumes that writing the event to the output log is synchronous. It should be possible to + // send the event asynchronously but we would need to ensure that 1) the events are written to the log in + // the correct order, 2) that pending writes are resent across restarts. In order to avoid writing all the + // necessary bookkeeping we'll keep the event sending synchronous for now. if err = writeEvent(ow, lastEventIDSent, event, newLatest); err != nil { return err }