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

Add Asynchronous Mode Support in Request Middleware and Improve Functionality #95

Closed
MEHRSHAD-MIRSHEKARY opened this issue Oct 3, 2024 · 0 comments · Fixed by #102
Closed
Assignees
Labels
enhancement New feature or request

Comments

@MEHRSHAD-MIRSHEKARY
Copy link
Collaborator

Feature Description

The following improvements are proposed:

  1. Asynchronous Mode Support: The request middleware should be updated to support asynchronous request handling (__acall__) without impacting the performance of synchronous views. This is crucial for applications using async views, channels, or other async-compatible frameworks.

  2. Seamless Dual-Mode Handling: The middleware should be able to switch between synchronous (__call__) and asynchronous (__acall__) modes based on the request context, ensuring full compatibility with both types of views.

  3. Improved Functionality:

    • Enhanced Logging: Allow better logging for asynchronous requests, including logging SQL queries, request metadata, and timing information in async mode.
    • Better Exception Handling: Ensure exceptions raised in async views are properly logged and handled by the middleware, without affecting the request flow.
    • Support for Optional Features: Extend optional features like SQL query logging and response timing to work seamlessly in both async and sync modes.

Benefits

  • Improved Performance: Full async support will improve performance in applications that utilize async views or database queries by preventing blocking operations.
  • Increased Flexibility: The ability to handle both synchronous and asynchronous requests in a single middleware will reduce the complexity of implementing separate middleware for async and sync requests.
  • Better Logging & Monitoring: Enhanced logging capabilities will allow more detailed tracking of request data, especially in asynchronous contexts, helping to debug and monitor async views more effectively.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant