Cleanup when finished #472

wants to merge 6 commits into


None yet

2 participants


This adds functionality to track the count of ongoing performBlock and save operations. This count allows for the ability to perform clean up when the current operations count reaches zero.

This provides a solution for the scenario in which long-running tasks are executing inside of the block being performed on a MOC and we want MagicalRecord to perform a clean up (For example in an application lockdown). Now a cleanUpWhenFinishedSaving method can be called to only tear down the Core Data stack when any ongoing operations have finished.

It is still the application's responsibility to prevent any future operations from being sent to MagicalRecord. However if cleanUpWhenFinishedSaving has been called, cleanUp will be executed when all performBlock and save operations have finished.

Note Created pull request against develop branch in response to #471

@tonyarnold tonyarnold was assigned Jan 1, 2014

I'm sorry it's taken such a long time to get to this, but are you proposing that we completely shut down the core data stack if the app is in the background? I wouldn't have thought that would be a common thing to do, but I'm keen to hear more — I'll target this for MagicalRecord 3.x.

@tonyarnold tonyarnold closed this Oct 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment