diff options
author | Tulir Asokan <tulir@maunium.net> | 2020-05-10 01:23:20 +0300 |
---|---|---|
committer | Tulir Asokan <tulir@maunium.net> | 2020-05-10 01:23:20 +0300 |
commit | f9007ae875d8f10e30f010414bc8bf2f9390de13 (patch) | |
tree | 5692d7d78512d7e8e6a01ba8a7bee5a015bbf525 | |
parent | 3b5840bb06010f4e87756b6d9fcf7a300d592a0a (diff) |
Send read receipts asynchronously. Hopefully fixes #141
-rw-r--r-- | matrix/matrix.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/matrix/matrix.go b/matrix/matrix.go index e9a4f79..e2e182e 100644 --- a/matrix/matrix.go +++ b/matrix/matrix.go @@ -795,8 +795,13 @@ func (c *Container) HandleTyping(_ EventSource, evt *event.Event) { } func (c *Container) MarkRead(roomID id.RoomID, eventID id.EventID) { - urlPath := c.client.BuildURL("rooms", roomID, "receipt", "m.read", eventID) - _, _ = c.client.MakeRequest("POST", urlPath, struct{}{}, nil) + go func() { + defer debug.Recover() + err := c.client.MarkRead(roomID, eventID) + if err != nil { + debug.Print("Failed to mark %s in %s as read: %v", eventID, roomID, err) + } + }() } func (c *Container) PrepareMarkdownMessage(roomID id.RoomID, msgtype event.MessageType, text, html string, rel *ifc.Relation) *muksevt.Event { |