python-discord / site

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

Upsert tags in two queries #1287

Closed jchristgit closed 3 months ago

jchristgit commented 3 months ago

Before, we had an N+1 query, where each tag would be separately fetched and updated. Instead, first delete any tags we no longer care about, then perform an upsert of all fields except for last_commit, which we want to keep from the existing tag.

This comes with one caveat: on the first update of the tags, the tags list is no longer modified in-place, because mutation is bad, however, the database state is updated accordingly.

netlify[bot] commented 3 months ago

Deploy Preview for pydis-static ready!

Name Link
Latest commit 996353e08b3970ab74ad12e97de1b26dad1291c1
Latest deploy log https://app.netlify.com/sites/pydis-static/deploys/660c18b6b5bed900083c995e
Deploy Preview https://deploy-preview-1287--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 996353e08b3970ab74ad12e97de1b26dad1291c1 on upsert-tags-in-three-queries into ad60d0270828367bda3a951222ea666eca2db76b on main.