praekeltfoundation / vumi

Messaging engine for the delivery of SMS, Star Menu and chat messages to diverse audiences in emerging markets and beyond.
BSD 3-Clause "New" or "Revised" License
420 stars 131 forks source link

Don't remove remote message ids for SMPP delivery reports #991

Closed justinvdm closed 8 years ago

justinvdm commented 8 years ago

Since #977 and #978, we remove message ids for failure and success delivery reports. It is common for us to get multiple delivery reports for the same message though, so we can't really do this.

hodgestar commented 8 years ago

I agree with this in general but I think there are two very common cases in which we can remove message ids:

Delivery can't un-succeed or un-permanently fail, so these should be the last delivery report messages we receive. Un-succeeded or un-permanently failing are definitely errors and we might as well save space in Redis and log the failures rather than handing them over to the application which can only look at these cases with wide eyes and shrug.

jerith commented 8 years ago

In practice, delivery reports are arbitrary and often full of lies (and even when they're not, the mapping from DR content to actual status isn't well defined). Also, out-of-order DR delivery is incredibly common and we need to handle the case where we receive "delivered" followed immediately by "pending" instead of the other way around.

jerith commented 8 years ago

On the other hand, I think it's entirely reasonable to reset the TTL to something much shorter when we receive a "final" DR status.

hodgestar commented 8 years ago

Plus one on setting a much shorter TTL.

justinvdm commented 8 years ago

Ready for review.

rudigiesler commented 8 years ago

:+1: from me, assuming that people are happy with the 1 hour timeout

jerith commented 8 years ago

Looks good, except for the assertion comment. You can look at other SMPP tests that make assertions about Redis TTLs to see how they handle the problem.

justinvdm commented 8 years ago

Ready for re-review.

hodgestar commented 8 years ago

One minor comment about assertion message text, otherwise looks good to me.

justinvdm commented 8 years ago

Assertion messages fixed.

hodgestar commented 8 years ago

:+1: