-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve errors when an item no longer exists
Two main user visible improvements: * If they keep a ref to an item, and that item disappears, calling a method on that item will now raise a helpful StaleProxyError, instead of a NoMethodError on nil * Enumerable and predicate methods will now behave better when they refer to stale proxies - filtering methods will just remove them. I run into this occasionally when I have multiple rules firing, and some of them are adding or removing items - and calling `items.locations` would raise a NoMethodError (now a StaleProxyError) for `#location?` due to a race condition. This should no longer happen - it will just ignore the now-stale items. The proxy code was significantly refactored, and Thing proxies will also inherit the same stale proxy handling. I also removed the $things registry lookup on every access of a thing, using the same event subscriber mechanism as Item. I also moved several methods from GenericItem to Item, so that Proxy can detect that those methods should exist even for dummy/stale items. Signed-off-by: Cody Cutrer <[email protected]>
- Loading branch information
Showing
12 changed files
with
395 additions
and
308 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.