-
Notifications
You must be signed in to change notification settings - Fork 132
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
apply() is lossy #119
Comments
The existing API could at least track the failure somewhere. |
I think I've got a race condition because of the p.s. More about the problem: https://stackoverflow.com/questions/49593476/android-sharedpreferences-apply-race-condition Look at the Mark Keen's comment. |
I'm seeing that the library creates a new |
We also encountered a major problem because of apply(). We NEED the atomic persistence to disk. I agree with not destroying the API, but why not expose the possibility from the library? Currently it's not possible to perform commit() using RxSharedPreferences. |
I ended up writing a library that provides a proper async key-value store: https://github.com/uber/simple-store |
Still missing this basic functionality.
In the current situation I have to either fork rx-preferences and change those library classes, patch around those limitations, or move to using another library. I think it's a very small, easy to implement request, and it doesn't break anything. |
Using apply() to save preferences is dangerous as it can and will silently fail.
Instead, all sets should use commit() and return a completable, throwing an error if commit() returns false.
The text was updated successfully, but these errors were encountered: