- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 676
 
Description
(Update 2022-11: Since #4620, we do retry these requests. But only (a) the next time the user scrolls past some other unread messages, which may happen arbitrarily far in the future or never happen, and (b) while the app remains running -- we don't persist to disk the user's desire to mark the messages as read. So the main content of this issue still applies.)
Currently, if a API request to mark messages as read fails, we never retry it. Instead, we should save a list of messages we have tried to mark as read (this should be persisted to disk, ideally, although maybe just putting it in the Redux state is a good enough start), and retry them periodically (probably using exponential backoff, maybe with some jitter?)
I think we should probably do this for every messagesFlags call, not just read state: thing like starring messages deserve to not be lost as well.
One thing I'm not sure about is how to deal with stateful logic in the src/api/ code — I don't know what dependencies we're OK with that code having (can it save stuff in Redux?). I think it would be good to aim to have fairly generic code for retrying any sort of API request, which we can at first just have apply to messagesFlags, but can add to other methods later, if we want.
It's also worth thinking about how the auth will get passed around when we do this — we want whatever is clearing out the retry queue to have the most recent auth rather than the one that the message was first sent with, most likely. We should also make sure that the code doesn't accidentally send messages to the wrong realm.