Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimize and enhance readability of UserVisitMiddleware
- 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.
- Loading branch information