Sometimes when I switch to another app and return to Quill later, or when my network connection is especially slow, the automatic data refresh in onResume gets stuck. What's worse, even cached data doesn't show up in the meantime, just a blank home screen, and even triggering a manual refresh doesn't help. The only way to fix it in such a case is to kill the app.
At one point I managed to catch this issue in action and noticed that the RefreshEventsQueue in NetworkService is not being cleared (presumably because a request didn't timeout directly -- perhaps a Retrofit issue?EDIT: see #90), which is what makes even manual refreshes useless.
Possible fixes / changes (more than one of them may be required for robustness):
[x] Make sure at least cached posts are loaded so the impact of stuck refreshes is much reduced (Ghost sets Cache-Control: no-cache on API responses, but I'm not sure why; see TryGhost/Ghost#1470 )
[x] Implement a timeout functionality for requests and / or refresh events (and display an appropriate error). The timeout on refresh events could be implemented by simply triggering refreshDone on all unfinished events when a certain timer (maybe 1 minute or so) expires.
[x] Ensure manual refreshes really do re-trigger a refresh rather than being ignored because an earlier refresh is stuck
Sometimes when I switch to another app and return to Quill later, or when my network connection is especially slow, the automatic data refresh in onResume gets stuck. What's worse, even cached data doesn't show up in the meantime, just a blank home screen, and even triggering a manual refresh doesn't help. The only way to fix it in such a case is to kill the app.
At one point I managed to catch this issue in action and noticed that the
RefreshEventsQueue
inNetworkService
is not being cleared (presumably because a request didn't timeout directly --perhaps a Retrofit issue?EDIT: see #90), which is what makes even manual refreshes useless.Possible fixes / changes (more than one of them may be required for robustness):
Cache-Control: no-cache
on API responses, but I'm not sure why; see TryGhost/Ghost#1470 )refreshDone
on all unfinished events when a certain timer (maybe 1 minute or so) expires.