-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[Auto-upload Published] Posts confirmed for auto-upload are not automatically uploaded #12420
Comments
Something that I found today that might be related to this. While working on #12324, I found out that whenever I edit and save a published post while offline, the You can most probably reproduce this easier in
When that happens, there are 2 places where we update the WordPress-iOS/WordPress/Classes/Services/PostService.m Lines 222 to 223 in c1d3284
And this:
I'm going to guess that one of those changes is delayed and executed after this failure block which (supposedly) correctly sets the
So the sequence probably ended up like this:
Stack TraceHere are 2 screenshots that show the different places where
Why This MattersBecause the WordPress-iOS/WordPress/Classes/Services/PostService.m Lines 71 to 77 in c1d3284
Status RefreshThe scenario I described here most probably only happens if the app has not been restarted. It looks like the app does attempt to “fix” these dangling
That gets executed on app launch. TLDR Race conditions suck. Tagging @diegoreymendez @leandroalonso in case this information is useful for them. |
After some investigation, seems like the underline issue here is with setting the remoteStatus in the awakeFromFetch method in AbstractPost to 'failed' if the post status is 'pushing'. When commenting out the remoteStatus setting in that method, the failed status is correctly set and the post will be picked up by the autoUploader when a connection is regained.
According to the comment there:
In the process of starting up the app (runStartupSequence in WordPressAppDelegate) we are calling the refreshStatus method that aims to do the same thing (convert posts with status pushing to failed) on a backgroundservice with a derived context
I'm not sure why the awakeFromFetch method causes this issue but I'd like to know if we still need to refresh the status there on the main context if we're doing it in the refreshStatus method. @koke, I know you wrote the awakeFromFetch override a long time ago (2013) but I'm hoping maybe you could help shed some light ? |
I think the purpose of that I think I went with that option because I was concerned about the performance hit during initialization (and maybe we weren't even using derived contexts back then). On that note, have we considered NSBatchUpdateRequest for |
Thank @koke . |
Done in #12567 |
Part of #12240. The fix should target the
issue/12240-master-branch
.This was found while testing #12419 but it does not seem to be related to it.
Expected behavior
Posts that are confirmed for auto-uploading are uploaded.
Actual behavior
Posts that are confirmed for auto-uploading do not get uploaded after the app is restarted.
Steps to reproduce the behavior
I was able to reproduce this on the #12419 branch.
This video shows the reproduction steps.
Tested on iPhone XS, iOS 12.4.1, WPiOS 2739aeb.
The text was updated successfully, but these errors were encountered: