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

Optimize and enhance readability of UserVisitMiddleware #30

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

786raees
Copy link

@786raees 786raees commented Dec 6, 2023

  • Isolated database query outside middleware call for efficiency.
  • Introduced log_duplicate_visit function for clear logging of duplicate visits.
  • Added save_user_visit function with single responsibility to save user visit.
  • Enhanced code readability with docstrings and comments.
  • Applied type annotations for better type checking and clarity.
  • Replaced atomic decorator with transaction.on_commit for better transaction handling.

- Isolated database query outside middleware call for efficiency.
- Introduced log_duplicate_visit function for clear logging of duplicate visits.
- Added save_user_visit function with single responsibility to save user visit.
- Enhanced code readability with docstrings and comments.
- Applied type annotations for better type checking and clarity.
- Replaced atomic decorator with transaction.on_commit for better transaction handling.

This commit refactors the UserVisitMiddleware to improve performance, readability, and adherence to best practices in code structure. Additional comments and type hints enhance maintainability and developer understanding.
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.

1 participant