-
Notifications
You must be signed in to change notification settings - Fork 12
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
Observe once #58
Observe once #58
Conversation
The observer will get removed after the callback runs
This prevents the callback from recursively calling itself. Genome had a 'commit' observer that was, itself, committing. It needed to jump through hoops to prevent the callback from getting recursively called inside the inner commit().
+1 pending tests. Looks useful! |
I had setup |
The travis-ci failure seems to be a real problem just for this branch. The same test failed twice in the same way, though only on Perl 5.8. I'm looking into it. |
To be absolutely clear, this failure is not due to the changes in this PR. At some point |
Travis CI appears to have changed the name of the "context" they use so the failure status for |
👍 Ready for merge. |
This adds a 'once' attribute to Observers. Their callbacks will only run once, then the observer will be deleted. It's deleted before the callback runs, so we won't have to worry about recursive calls, such as when calling commit() in a commit observer.