-
-
Notifications
You must be signed in to change notification settings - Fork 735
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
Attempt to re-save installation if Installation was deleted on the server #579
Attempt to re-save installation if Installation was deleted on the server #579
Conversation
Besides this PR matching iOS, do you see this issue for yourself? |
@rogerhu
ParseInstallation installation = ParseInstallation.getCurrentInstallation();
// put some parameters here
...
installation.saveInBackground();
The following is my scenario:
If the device with the above installation scenario, the push notification won't be received in production environment due to no installation data in db-B. |
Great thanks for the explaination. Is there a way to add a test for this? |
@hermanliang updated the pull request - view changes |
@rogerhu |
|
||
installation.saveAsync(sessionToken, toAwait); | ||
|
||
verify(controller, times(1)).getAsync(); |
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.
minor optimization -- this can be verify(controller).getAsync();
http://static.javadoc.io/org.mockito/mockito-core/2.7.16/org/mockito/Mockito.html#verify(T)
verify(mock).someMethod("some arg");
Above is equivalent to:
verify(mock, times(1)).someMethod("some arg");
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.
update it by 94da911
Thanks
@@ -2815,6 +2815,15 @@ private void rebuildEstimatedData() { | |||
} | |||
} | |||
|
|||
/* package */ void markAllFieldDirty() { | |||
synchronized (mutex) { | |||
estimatedData.clear(); |
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.
@natario1 will any changes be necessary for safeKeys() if we merge this in?
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.
@rogerhu no, it’s OK as it is now.
I think code coverage will be higher after you rebase. :) |
09ff6f5
to
713e311
Compare
rebased / force pushed to your branch |
@hermanliang updated the pull request - view changes |
@hermanliang updated the pull request - view changes |
Lgtm thanks |
lgtm |
@hermanliang @rogerhu isn’t your method I think you could have used that instead. |
@natario1 I think the two methods call is not the same and also for different purposes. |
Can we use markallDirty inside the rebuildEstimatedData function? Seems like it's repeated? Also it should be plural markAllFields |
@rogerhu They're different.
So if use markAllDirty inside the rebuildEstimatedData, the transmission size might be increased.
|
Gotcha. They are different. Looking at https://github.com/ParsePlatform/Parse-SDK-iOS-OSX/blob/2504c19f03698b4f7d89a22708133a410b17fba9/Parse/PFInstallation.m#L73-L80 though markAllFields (should be plural) puts the estimatedData. Yours seems to clear and then write the current state instead of the cached data? |
Yes, the cached installation needs to be rebuilt by new installation after being saved to the server.
After the re-saving process, cached installation file will be overwritten by new one. The above operation seems to not allow when the local datastore is enabled due to objectID is unchangeable after it's created. (But I think it should be allowed in this case.) BTW, thanks for your correction. I created a PR (#602) for renaming the function (markAllFieldDirty -> markAllFieldsDirty). |
great thanks for the explanation. I guess my question is that markAllFieldsDirty() in the iOS SDK (https://github.com/ParsePlatform/Parse-SDK-iOS-OSX/blob/2504c19f03698b4f7d89a22708133a410b17fba9/Parse/PFInstallation.m#L73-L80) seems to mark all the cached data entries as dirty. it seems like you want to clear the cache, reset it to the original state, and clear object ID. I guess my question is why there's a difference? |
I know your question now. 😄 |
Reference: Parse-SDK-iOS-OSX/PFInstallation.m#saveAsync