-
Notifications
You must be signed in to change notification settings - Fork 16
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
How do I casbin_redis_watcher with a device? #13
Comments
working on this |
I noticed you use a package named Seems the problem caused by
Maybe you should setup watcher and enforcer in the |
I guess it use popen to operate redis, which may cause unexpected error when it works with fastapi |
casbin_redis_watcher's home page is https://pypi.org/project/pycasbin-redis-watcher/ hope it's casbin_redis_watcher is an officially recommended plug-in for casbin to synchronize permission descriptions for different nodes This is necessary for me |
@YihuiLu
So, you should use startup action for fastapi. |
Thank you for your reply, I've tried to use casbin_redis_watcher in startup, but there's another problem: ScienceLogic/pycasbin-redis-watcher#2 |
Try something like proc = None
def run():
uvicorn.run(app=app, host=host, port=port)
def start():
global proc
proc = Process(target=run, args=(), daemon=True)
proc.start() and use start() in the |
In fact, this is still not a good idea. pycasbin-redis-watcher looks not designed for asyncio. |
I look forward to your writing of an asyncio version, and I hope to be able to help you. For the time being, I might consider giving up Casbin and Fastapi for the time being, because it's more difficult to But if I can set a plan for writing an asyncio version of Watcher, I'm willing to participate and make it part of my job |
I throw an error when I use the following code
The text was updated successfully, but these errors were encountered: