Repository navigation
fix: App crashes with "Task should be completed." or sends saveEventually requests twice after Parse.setServer - #1934
Conversation
…ually` requests twice after `Parse.setServer`
|
🚀 Thanks for opening this pull request! We appreciate your effort in improving the project. Please let us know once your pull request is ready for review. Tip
Note Please respond to review comments from AI agents just like you would to comments from a human reviewer. Let the reviewer resolve their own comments, unless they have reviewed and accepted your commit, or agreed with your explanation for why the feedback was incorrect. Caution Pull requests must be written using an AI agent with human supervision. Pull requests written entirely by a human will likely be rejected, because of lower code quality, higher review effort and the higher risk of introducing bugs. Please note that AI review comments on this pull request alone do not satisfy this requirement. Our CI and AI review are safeguards, not development tools. If many issues are flagged, rethink your development approach. Invest more effort in planning and design rather than using review cycles to fix low-quality code. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1934 +/- ##
===========================================
+ Coverage 64.24% 85.73% +21.49%
===========================================
Files 201 282 +81
Lines 23233 31187 +7954
===========================================
+ Hits 14926 26739 +11813
+ Misses 8307 4448 -3859 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
## [7.0.2](7.0.1...7.0.2) (2026-10-23) ### Bug Fixes * App crashes with "Task should be completed." or sends `saveEventually` requests twice after `Parse.setServer` ([#1934](#1934)) ([955b230](955b230))
|
🎉 This change has been released in version 7.0.2 |
New Pull Request Checklist
Issue Description
Since #1708 (2.0.3),
+[Parse setServer:]re-initializes Parse with a newParseManager, and the eventually queue of the previous manager keeps running on the same pending commands. When connectivity returns whilesaveEventuallycommands are pending, both queues run them. The app crashes withNSInternalInconsistencyException("Task should be completed.") if the previous manager was deallocated, or sends the request twice. With the local datastore, the second request is an empty save.Closes: #1920
Approach
setServer:no longer re-initializes Parse. It sets the new server URL in the configuration and the command runner of the current manager, so there is only one eventually queue. #1528 said that the SDK must be re-initialized because the server URL is stored in many controllers. Only the command runner and its request constructor hold it, and the constructor reads it for every request.PFPushController, the only controller that keeps a command runner, keeps the same instance. The runner is changed, not replaced, because releasing a runner cancels the requests it is sending, and the eventually queue removes a cancelled command as finished.saveEventuallyanddeleteEventuallycommands queued beforesetServer:.setServer:also makes the eventually queue retry its pending commands right away. Otherwise a command that waits to be retried after a temporary error, which is likely when the previous server fails, would wait up to 10 minutes (the retry interval) before it goes to the new server.setServer:no longer postsPFParseInitializeDidCompleteNotification, which is documented as being for testing, and no longer callsparseDidInitializeWithApplicationId:clientKey:of Parse modules.setServer:raised an exception, because the delegate was registered with the previous managersaveAll, keep the path of the previous server URL. ThesetServer:docs now say that they fail if the new server URL has a different path.The 7 new tests in
ParseSetupUnitTestsfail on master. They cover:setServer:TODOs before merging
Summary by CodeRabbit