Skip to content

feat: Add changes and corner cases to allow casbin-redis-watcher to work with flask authz and redis 5#16

Closed
favipcj wants to merge 2 commits into
pycasbin:masterfrom
favipcj:add-corner-cases-to-work-with-flask-authz
Closed

feat: Add changes and corner cases to allow casbin-redis-watcher to work with flask authz and redis 5#16
favipcj wants to merge 2 commits into
pycasbin:masterfrom
favipcj:add-corner-cases-to-work-with-flask-authz

Conversation

@favipcj

@favipcj favipcj commented Oct 4, 2024

Copy link
Copy Markdown

Feature description

This PR covers corner cases that are needed when using flask-authz, specifically:

  1. Add should_reload and update_callback methods that flask-authz needs https://github.com/pycasbin/flask-authz/blob/master/flask_authz/casbin_enforcer.py#L66-L67
  2. Retry when Redis times out or when Redis is down for some time
  3. Be able to recreate threads after some time(10sec) that were killed for any reason for example when the redis connection dies even after the configured retries. (This is important when running this watcher + flask-authz)
  4. Add some error handling to the subscribe method to show message errors related to redis and close the redis connection before the thread is killed
  5. Be able to receive a logger instance as an argument when creating the watcher

To make this library work with any Python library Redis version including redis 5, a different instance of the Redis class was created for the subscriber and publisher, as that is required for Redis 5 and still works for other old versions as well.

CI/Unit test Running https://github.com/favipcj/redis-watcher/actions/runs/10965417424. Only a minor change was added to the ci workflow to only release builds in the master branch

Carme Pamy added 2 commits September 20, 2024 15:41
…ts disconnected or other cause + create separted redis connections to make it work with redis5
@CLAassistant

CLAassistant commented Oct 4, 2024

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@favipcj favipcj changed the title feat: Add corner cases to work with flask authz and pyredis 5 feat: Add changes and corner cases to allow casbin-redis-watcher to work with flask authz and pyredis 5 Oct 4, 2024
@favipcj favipcj changed the title feat: Add changes and corner cases to allow casbin-redis-watcher to work with flask authz and pyredis 5 feat: Add changes and corner cases to allow casbin-redis-watcher to work with flask authz and redis 5 Oct 4, 2024
@favipcj

favipcj commented Nov 6, 2024

Copy link
Copy Markdown
Author

hey @hsluoyz when you get a chance, could you please take a look at these changes and let me know if changes are required ?

@favipcj

favipcj commented May 6, 2025

Copy link
Copy Markdown
Author

Can we please have a review on this PR @hsluoyz ?

@favipcj

favipcj commented May 7, 2025

Copy link
Copy Markdown
Author

closed in favor of apache/casbin-python-redis-watcher#3

@favipcj favipcj closed this May 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants