Fix handling of instance/network down #769
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I am making this PR a draft as a different approach has been suggested.
Pull Request Description
This PR fixes an issue raised in Matrix chat which is that, if the user's network or instance is currently down, Thunder will spin forever (and also be frozen, such that the user cannot switch accounts). This is because, as of #717, we now do a downvote check during account loading (which precedes the network handling introduced in #655).
The fix is simply to wrap this initial check in a try/catch and add a timeout so that it can't kill us. Then we'll proceed with the feed loading, which is where the network handling exists. I suppose there's a tiny edge case where (a) we're connecting to an instance with downvotes disabled, (b) the downvote check fails (i.e., temporary outage), and (c) the feed loading succeeds. In this case, the downvote buttons will appear but not work. I hope this is such a narrow case and negilble impact that it will be acceptable.
I also updated some timeouts throughout the app to be more consistent.
Issue Being Fixed
Issue Number: N/A
Screenshots / Recordings
Checklist
semanticLabel
s where applicable for accessibility?