router: always update msg ID cache

Bridges can now return different message IDs in response to edits.
This commit is contained in:
Qais Patankar
2019-06-19 13:56:38 +01:00
parent 582587d7b0
commit fba2749b0b

View File

@@ -140,10 +140,11 @@ func (r *Router) handleReceive() {
for _, br := range gw.Bridges { for _, br := range gw.Bridges {
msgIDs = append(msgIDs, gw.handleMessage(&msg, br)...) msgIDs = append(msgIDs, gw.handleMessage(&msg, br)...)
} }
// only add the message ID if it doesn't already exists
if _, ok := gw.Messages.Get(msg.Protocol + " " + msg.ID); !ok && msg.ID != "" { // Always add/update the message ID. This is necessary as msgIDs
gw.Messages.Add(msg.Protocol+" "+msg.ID, msgIDs) // will change if a bridge returns a different ID in response to edits.
} gw.Messages.Add(msg.Protocol+" "+msg.ID, msgIDs)
idx++ idx++
} }
} }