You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 9, 2022. It is now read-only.
Even if the list of slugs isn't used, it is currently loaded from the database every time an instance of SlugList is made. Finding the slugs requires a full scan of the table slug_to_slug, which is wasteful if it's not going to be used.
A better approach would be to only fetch the list of slugs once requested.
Store slugs from constructor in self._slugs
Use self._slugs in canonical_slug (so it won't trigger fetching the list of slugs)
Fetch and return list of slugs from the database when self.slugs is referenced.
Do so only the first time self.slugs is referenced, and populate self._slugs. On subsequent references, return self._slugs.
Don't fetch list of slugs in SlugList.from_slug().
The text was updated successfully, but these errors were encountered:
Even if the list of slugs isn't used, it is currently loaded from the database every time an instance of SlugList is made. Finding the slugs requires a full scan of the table
slug_to_slug
, which is wasteful if it's not going to be used.A better approach would be to only fetch the list of slugs once requested.
self._slugs
self._slugs
incanonical_slug
(so it won't trigger fetching the list of slugs)self.slugs
is referenced.self.slugs
is referenced, and populateself._slugs
. On subsequent references, returnself._slugs
.SlugList.from_slug()
.The text was updated successfully, but these errors were encountered: