Open hackaugusto opened 4 years ago
~As an additional side note: Since Matrix is a chat room, the messages do persist for some time, retrying is totally necessary under most circumstances, with the exception of when an operator clear the messages to free up space. Therefore the retry timeout can be significantly large. Ideally we would be able to detect if a message was removed from the room, and only retry then.~
Edit: I forgot one scenario, retries are necessary to fix race conditions against the blockchain, so the retry interval cannot be large, it has to be around the expect time it takes for a block to propagate through the network.
Regarding your last point, there is #4110 which is somewhat related.
About 2nd, the reason it was done like that is performance: having a per-message generator allows us to batch all messages that need to be sent in the same time window (I think rn the loop is ~5s). Specially on bursts of messages to the same room, this can save us several requests. Just a headsup though, go ahead if you think it's not worth it.
@andrevmatos did you measure the performance impact? Do you have a reference to the results?
No, we didn't, but everytime you see N messages batched together, you can assume the http roundtrip time for sending these messages was cut ~N times
Abstract
RetryQueue
a plain old data object, instead of a separate thread.retry_interval
has to be dependent on the currentexpiration
.Ping
,Pong
, andDelivered
. These messages by definition are not retriable, so they don't have to go to the queue and have special handling there.