Skip to content
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: fixed should_reload behaviour, close PostgreSQL connections, block until PostgresqlWatcher is ready, refactorings #29

Merged
merged 33 commits into from
Jul 16, 2024

Conversation

trbtm
Copy link
Contributor

@trbtm trbtm commented Jul 8, 2024

  1. PostgresqlWatcher.update_callback gets called by should_reload
  2. Close connection to PostgreSQL when Process gets terminated
  3. Block the thread until PostgresqlWatcher is ready to receive updates
  4. Adjusted README to make it clear to the user that they have to call PostgresqlWatcher.should_reload before Enforcer.enforce
  5. Improved unit tests
  6. Run black on the whole project
  7. Other refactorings

trbtm added 27 commits July 8, 2024 12:17
       - Make PostgresqlWatcher.create_subscription_process a private method
       - Rename casbin_subscription to _casbin_channel_subscription
      decrease select timeout to one second in child Process
      remove infinite timout in PostgresqlWatcher.should_reload
      create a new watcher instance for every test case
      Moved channel subscription function to separate file and added context
      manager for the connection, that handles SIGINT, SIGTERM for proper resource
      cleanup
@trbtm trbtm mentioned this pull request Jul 8, 2024
Copy link
Contributor

@pradeepranwa1 pradeepranwa1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, also i have implemented this on my production env

@leeqvip leeqvip merged commit 8382db4 into pycasbin:master Jul 16, 2024
14 checks passed
github-actions bot pushed a commit that referenced this pull request Jul 16, 2024
## [1.1.1](v1.1.0...v1.1.1) (2024-07-16)

### Bug Fixes

* fixed `should_reload` behaviour, close PostgreSQL connections, block until `PostgresqlWatcher` is ready, refactorings ([#29](#29)) ([8382db4](8382db4))
Copy link

🎉 This issue has been resolved in version 1.1.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants