-
-
Notifications
You must be signed in to change notification settings - Fork 735
Re-save installation is allowed if LDS is enabled #607
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
Re-save installation is allowed if LDS is enabled #607
Conversation
Separate question. have you considered just setting applicationId to be different for dev/prod? Mixing cached data in general across prod/dev is going to cause you lots of problems in general. |
@@ -143,9 +143,7 @@ public String getInstallationId() { | |||
@Override | |||
public Task<Void> then(Task<Void> task) throws Exception { | |||
// Retry the fetch as a save operation because this Installation was deleted on the server. | |||
// Do not attempt to resave an object if LDS is enabled, since changing objectId is not allowed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So is it fairly easy to null out your objectId() on a failure and then cause multiple install id's per app?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only the ParseException.OBJECT_NOT_FOUND
(line 148) can trigger the re-creating process.
If just null out the objectId and save installation will not create another installation data. (It's weird, I'm still figuring out why)
BTW, I think setObjectId()
should not be a public method, package private may be more appropriate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha line 148 is indeed key.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw this line can be removed, there is instanceof
below
@rogerhu Thanks for your suggestion. |
I think you really shouldn't be mixing dev/prod. :) Even your push infra should silo the two environments as well (separate GCM keys). Your PR seems fine for the problem it tries to rectify...given you pointed out the iOS SDK tries to do something similar does it do the same thing? |
@rogerhu The iOS SDK is NOT allowed this operation if LDS is enabled. ParseObject object = new ParseObject("Test");
object.put("key", "value");
object.save(); // add to server
object.pin(); // add to LDS
object.setObjectId(null); // for replication purpose
object.save(); // add to server
object.pin(); // will REPLACE previous object to LDS
ParseQuery.getQuery("Test").count(); // count: 2 (server)
ParseQuery.getQuery("Test").fromPin().count(); // count: 1 (datastore) In ParseInstallation, following operation will clear/replace the cached installation's objectId (shouldn't be allowed, fixed in PR #611)
If setObjectId() is not allowed in ParseInstallation (PR #611), I think the above case will not happen. |
Does this change then how the Android version does it to ios then? |
Thanks @hermanliang - this is on a backlog, and appreciate you doing the work on both platforms. Can anyone take a look and provide any feedback? I think it addresses a weird corner case of mixing dev/prod instances data. But @hermanliang has done a ton of work and would love help taking a look. |
Thanks @rogerhu
|
Codecov Report
@@ Coverage Diff @@
## master #607 +/- ##
============================================
+ Coverage 51.27% 51.56% +0.28%
- Complexity 1536 1546 +10
============================================
Files 129 129
Lines 9835 9837 +2
Branches 1327 1327
============================================
+ Hits 5043 5072 +29
+ Misses 4384 4354 -30
- Partials 408 411 +3
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #607 +/- ##
============================================
+ Coverage 52.56% 53.62% +1.06%
- Complexity 1664 1688 +24
============================================
Files 131 131
Lines 10138 10142 +4
Branches 1407 1408 +1
============================================
+ Hits 5329 5439 +110
+ Misses 4369 4245 -124
- Partials 440 458 +18
Continue to review full report at Codecov.
|
rebase |
3978c25
to
8a314f6
Compare
rebase |
8a314f6
to
6a2abc2
Compare
rebased |
This build failed actually. Can you fix? |
Following PR #579 and resolving Issue #605