Skip to content

Conversation

abdullai-t
Copy link
Contributor

@abdullai-t abdullai-t commented Nov 25, 2024

Summary / Highlights

This pull request includes several changes to the codebase, focusing on middleware updates, caching improvements, and minor refactoring. The most important changes are listed below:

Middleware Updates:

  • Added GateMiddleware to handle non-existent endpoints with a 404 response in src/_main_/settings.py and created the middleware class in src/api/middlewares/gate_middleware.py. [1] [2]

Caching Improvements:

  • Enabled @cached_request decorator for several list methods in various handler files to improve performance by caching responses. [1] [2] [3] [4] [5]

Code Refactoring:

  • Updated the wrapper function in src/api/decorators.py to use a more efficient caching key and added a check for test mode.
  • Removed unused imports and cleaned up code in src/api/services/team.py.
  • Simplified the info method in src/database/models.py to handle cases where self.community is None.

Logging Improvements:

  • Added a check to skip logging if the message is empty in src/_main_/utils/massenergize_logger/__init__.py.

Minor Fixes:

  • Changed the return value of _get_file_url to an empty string instead of None when the image is not present in src/website/views.py.

Details (Give details about what this PR accomplishes, include any screenshots etc)

Testing Steps (Provide details on how your changes can be tested)

Requirements (place an x in each [ ])

  • I've read and understood the Contributing Guidelines and have done my best effort to follow them.
  • I've tested my changes manually.
  • I've added unit tests to my PR.
Transparency (Project board)
  • I've given my PR a meaningful title.
  • I linked this PR to the relevant issue.
  • I moved the linked issue from the "Sprint backlog" to "In progress" when I started this.
  • I moved the linked issue to "QA Verification" now that it is ready to merge.

Copy link

codecov bot commented Nov 26, 2024

Codecov Report

Attention: Patch coverage is 87.03704% with 7 lines in your changes missing coverage. Please review.

Project coverage is 58.40%. Comparing base (e72a4a8) to head (86ca8e0).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/_main_/utils/massenergize_logger/__init__.py 0.00% 2 Missing ⚠️
src/api/middlewares/gate_middleware.py 83.33% 2 Missing ⚠️
src/website/views.py 0.00% 2 Missing ⚠️
src/api/decorators.py 88.88% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1189   +/-   ##
=======================================
  Coverage   58.40%   58.40%           
=======================================
  Files         495      496    +1     
  Lines       36932    36950   +18     
=======================================
+ Hits        21570    21581   +11     
- Misses      15362    15369    +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@abdullai-t abdullai-t changed the title Fix-url-resolution-bug Fix: URL Resolution, Team Stats Query Optimization and Caching Nov 26, 2024
@abdullai-t abdullai-t closed this Dec 3, 2024
@abdullai-t abdullai-t reopened this Dec 3, 2024
@abdullai-t abdullai-t marked this pull request as draft December 4, 2024 10:58
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