mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-01 13:52:46 +00:00
Minor SendToDevice fix (#2565)
* Avoid unnecessary marshalling if sending to the local server * Fix ordering of ToDevice messages * Revive SendToDevice test
This commit is contained in:
parent
3ea21273bc
commit
09f0ff14c8
4 changed files with 129 additions and 85 deletions
|
@ -49,7 +49,7 @@ const selectSendToDeviceMessagesSQL = `
|
|||
SELECT id, user_id, device_id, content
|
||||
FROM syncapi_send_to_device
|
||||
WHERE user_id = $1 AND device_id = $2 AND id > $3 AND id <= $4
|
||||
ORDER BY id DESC
|
||||
ORDER BY id ASC
|
||||
`
|
||||
|
||||
const deleteSendToDeviceMessagesSQL = `
|
||||
|
@ -120,9 +120,6 @@ func (s *sendToDeviceStatements) SelectSendToDeviceMessages(
|
|||
logrus.WithError(err).Errorf("Failed to retrieve send-to-device message")
|
||||
return
|
||||
}
|
||||
if id > lastPos {
|
||||
lastPos = id
|
||||
}
|
||||
event := types.SendToDeviceEvent{
|
||||
ID: id,
|
||||
UserID: userID,
|
||||
|
@ -132,6 +129,9 @@ func (s *sendToDeviceStatements) SelectSendToDeviceMessages(
|
|||
logrus.WithError(err).Errorf("Failed to unmarshal send-to-device message")
|
||||
continue
|
||||
}
|
||||
if id > lastPos {
|
||||
lastPos = id
|
||||
}
|
||||
events = append(events, event)
|
||||
}
|
||||
if lastPos == 0 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue