forked from Silverfish/proton-bridge
When we send a message, the send recorder records the sent message. When the client then appends an identical message to the sent folder, the deduplication works and instead returns the message ID of the existing proton message, rather than creating a new message. Gluon is expected to notice that it already has this message ID and perform some deduplication stuff internally. However, it can happen that gluon doesn't yet have this message ID, because we haven't yet received the "Message Created" event from the API. To prevent this, we poll the events after send and wait for all new events to be applied. There's still a chance that the event wasn't generated yet on the API side. Not sure what we can do about this.