Originally created by @JoeMatt on GitHub (Dec 18, 2015).
When activating the CoreData launch flag -com.apple.CoreData.ConcurrencyDebug 1 all of the included tests assert at the first managed object creation attempt.
Originally created by @JoeMatt on GitHub (Dec 18, 2015).
When activating the CoreData launch flag `-com.apple.CoreData.ConcurrencyDebug 1` all of the included tests assert at the first managed object creation attempt.
Yup, this is expected to happen. The com.apple.CoreData.ConcurrencyDebug flag lets Core Data tell you when the managed context is accessed from any queue other than its own, which includes CoreStore's transactions' queues (beginAsynchronous(), etc).
CoreStore already guarantees safety for you by making the Main Context read-only, and by only allowing updates to be made within transactions. You should be safe even without the ConcurrencyDebug flag (as long as you don't do hacky things).
I'll close this for now but feel free to ask if you have other questions :)
@JohnEstropia commented on GitHub (Dec 18, 2015):
Thanks for the feedback!
Yup, this is expected to happen. The `com.apple.CoreData.ConcurrencyDebug` flag lets Core Data tell you when the managed context is accessed from any queue other than its own, which includes CoreStore's transactions' queues (`beginAsynchronous()`, etc).
CoreStore already guarantees safety for you by making the Main Context read-only, and by only allowing updates to be made within transactions. You should be safe even without the ConcurrencyDebug flag (as long as you don't do hacky things).
I'll close this for now but feel free to ask if you have other questions :)
Would storing the managed object returned from a synchronous fetch as a Swift computed property be "hacky"
Trying to debug why we see random faults and that's about the strangest thing I think we're doing.
@JoeMatt commented on GitHub (Dec 18, 2015):
Would storing the managed object returned from a synchronous fetch as a Swift computed property be "hacky"
Trying to debug why we see random faults and that's about the strangest thing I think we're doing.
self.object=CoreStore.fetchOne(...)// or datastack.fetch...
If so then it should be fine.
I'm also curious what you meant by "random faults". If you are editing the object from inside a transaction, the object stored in the property is expected to refetch its new values (and is probably what you are observing).
@JohnEstropia commented on GitHub (Dec 18, 2015):
Do you mean something like this?
``` swift
self.object = CoreStore.fetchOne(...) // or datastack.fetch...
```
If so then it should be fine.
I'm also curious what you meant by "random faults". If you are editing the object from inside a transaction, the object stored in the property is expected to refetch its new values (and is probably what you are observing).
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @JoeMatt on GitHub (Dec 18, 2015).
When activating the CoreData launch flag
-com.apple.CoreData.ConcurrencyDebug 1all of the included tests assert at the first managed object creation attempt.@JohnEstropia commented on GitHub (Dec 18, 2015):
Thanks for the feedback!
Yup, this is expected to happen. The
com.apple.CoreData.ConcurrencyDebugflag lets Core Data tell you when the managed context is accessed from any queue other than its own, which includes CoreStore's transactions' queues (beginAsynchronous(), etc).CoreStore already guarantees safety for you by making the Main Context read-only, and by only allowing updates to be made within transactions. You should be safe even without the ConcurrencyDebug flag (as long as you don't do hacky things).
I'll close this for now but feel free to ask if you have other questions :)
@JoeMatt commented on GitHub (Dec 18, 2015):
Would storing the managed object returned from a synchronous fetch as a Swift computed property be "hacky"
Trying to debug why we see random faults and that's about the strangest thing I think we're doing.
@JohnEstropia commented on GitHub (Dec 18, 2015):
Do you mean something like this?
If so then it should be fine.
I'm also curious what you meant by "random faults". If you are editing the object from inside a transaction, the object stored in the property is expected to refetch its new values (and is probably what you are observing).