Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent refresh race conditions #40

Merged
merged 7 commits into from Sep 8, 2016
Merged

Conversation

Gi-lo
Copy link
Contributor

@Gi-lo Gi-lo commented Sep 7, 2016

NOTE
This is pretty similar to the bug found in the iOS version of Heimdallr

Description
When calling getValidAccessToken() multiple times it might query any amount of refresh calls. This might confuse/flood the server and the app behaving not as expected.

Solution
On grantNewAccessToken which is called from getValidAccessToken we check if there already is a request to grab the access token. If so we simply subscribe to it. Only if there is none we create a new one.

@Gi-lo Gi-lo added the bug label Sep 7, 2016
mTokenObservable = null;
})
.toObservable()
.cache();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cache here would mean that every time we subscribe every element will be replayed right?

@Gi-lo Gi-lo merged commit 6246ede into master Sep 8, 2016
@Gi-lo Gi-lo deleted the feature/BUG_race_conditions branch September 8, 2016 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants