-
-
Notifications
You must be signed in to change notification settings - Fork 119
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
Allow custom operations in ClearDatabaseRule and avoid locale changes #346
Conversation
library/src/main/java/com/schibsted/spain/barista/rule/cleardata/internal/DatabaseOperations.kt
Outdated
Show resolved
Hide resolved
Hello @AhmedGamal92! Thanks for contributing :) I'm not sure I understood the issue you're mentioning about the locale and Barista rule. Maybe you could write a test reproducing this issue with Barista? That way we can understand your problem and make sure the fix is effective. Thanks! |
Hello @Sloy, Thanks for checking :) So with this PR I'm trying to do two issues
|
Hi @AhmedGamal92! One question... didn't you able to do that with the current approach? I mean, you could extend I mean, I think we can do the same with less code 😄 And about the Thanks! |
Hi @rocboronat
It's a final internal class so can't do that with current implementation. Maybe we can add default implementation for the interface as yes less code is better :D
What happens is that I get db locked exceptions while trying to open the db to clear tables as opening the db without that flag will change the locale, and I don't think the clear database rule should do that, and the issue I had I think is some race condition where db is being created with adding locale while the rule tries to do the same. |
And what about if we made it just not internal? @Sloy any preference about it? Wow, about your issue, so strange. It would be nice to have a way to reproduce it 😢 |
I guess we could make the class But I also would like to have some kind of reproduction of the issue, because right now I don't really understand it. We have never encountered any problems with our non-English locales, and I have never used the Actually, the documentation for that flag is scary, especially the part were it says "You must be consistent when using this flag to use the setting the database was created with." @AhmedGamal92 how can we reproduce your issue? Creating the database with a specific locale? Or inserting some special characters? Or setting some language in the device? If we know how to reproduce it manually maybe we can find a way to write a test for it. |
@Sloy @rocboronat So for now I will update the PR to make the class open, and will let you know if I was able to reproduce that. |
7a2a335
to
eeeb60f
Compare
Were you able to reproduce the issue in the sample @AhmedGamal92? So sorry we went dark, reading the conversation again I think we can merge this PR as it is right now. |
Hey @Sloy, |
Thank you @AhmedGamal92! :) |
The purpose of this PR is to allow custom database operations to be passed from users of the library.
Also opening databases with NO_LOCALIZED_COLLATORS to avoid changing the db locale, which can cause exceptions like locked db while trying to execute the rule.