conditionally restart connection after refetch or reauth #26
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.
Fixes #22
resumeSocket()
out ofrefetchToken()
and intosetConfig()
, which is the only place a pause is initiated. This clarifies where this call actually needs to occur.refetchToken()
ortryToReauthenticate()
, if the connection is stopped, restart it. Because it's possible for these two functions to run before or after one another for multiple reasons, this ensures a connection doesn't remain stopped after a potentially successful reauth.restartSocket()
to no longer throw if attempted on an unstopped connection, similar to how resume works. Restart is only attempted byrefetchToken()
andtryToReauthenticate()
, and there's no guarantee whether the connection will be stopped or not.