python-discord / site

pythondiscord.com - A Django and Bulma web application.
https://pythondiscord.com
MIT License
638 stars 127 forks source link

Prefetch the filter_list field in the FilterListSerializer #1286

Closed jb3 closed 3 months ago

jb3 commented 3 months ago

We were experiencing an issue in production where the api:bot:filterlist-list view was taking several seconds to process, upon enabling query logs and monitoring for this we found it was making a query for every filter in the database.

Prefetching the filter_list field solves this and greatly reduces the query count, optimising the route.

netlify[bot] commented 3 months ago

Deploy Preview for pydis-static ready!

Name Link
Latest commit e50c8a14c8116c75bc9ae23dd45c9dae9dc96fcd
Latest deploy log https://app.netlify.com/sites/pydis-static/deploys/660af50f93476f000960ca2d
Deploy Preview https://deploy-preview-1286--pydis-static.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

coveralls commented 3 months ago

Coverage Status

coverage: 100.0%. remained the same when pulling e50c8a14c8116c75bc9ae23dd45c9dae9dc96fcd on jb3/filterlist-perf-improvements into 4508acae8569d4d3aa308c7532db3ac686a04b28 on main.