-
-
Notifications
You must be signed in to change notification settings - Fork 195
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
feat: Added support for async watcher callbacks #340 #341
feat: Added support for async watcher callbacks #340 #341
Conversation
AsyncEnforcer can now also await Watcher callbacks if they are Coroutines.
@Nekotoxin please review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add some unit tests to them?
Sure thing! |
I've added pytests to verify the functionality of async watcher callbacks. Note: I used the existing pytest for synchronous calls as a reference for creating this async version.
@tanasecucliciu fix linter |
16c2489
to
6657f12
Compare
|
||
await e.save_policy() | ||
self.assertEqual(w.notify_message, "called save policy") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whether save_policy
should also depend on auto_notify_watcher
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hsluoyz I saw the same in go's casbin.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any updates on this issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@leeqvip it should behave the same way as Go
🎉 This PR is included in version 1.36.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
AsyncEnforcer can now also await Watcher callbacks if they are Coroutines. Related to #340.
Fix: #340