If an edition is missing its work, this change allows the page to still
load without a server error; this is important because otherwise the
book will break every page it appears on, including the feed page.
The main reason to do this is that if we try to add another name then
pylint will complain that there are too many return statements. It might
be slightly faster too.
If I understand correctly it doesn’t matter that the _ function is being
called at module load time because it is mapped to gettext_lazy so the
actual translation will be done when the string is used.
I originally set this for a very long timeout because this value should
be invalidated when it needs to be by the models, and if that worked
perfectly, this would reduce queries dramatically for books that show up
in ones feed frequently, but don't change status (for example, a book
you read and your friend is currently posting about). In practice, of
course, there are errors in invalidating this cache which leave this
value appearing extremely broken and it's next to impossible to fix.
This change makes each of the timeouts related to reading an hour, which
will still give performance benefit when browsing the site (especially
for loading the same book multiple times on a page), but resolve
naturally if the cache gets into a bad state.
The original system customized how a rating is displayed to every user
based on the privacy settings of the reviews and, relatedly, who the
user follows. This is cool, but the query is too complicated to load in
sessions, and the initial load, which isn't mitigated by caching, is too
much and causes timeouts for many users. Also the cache clearing wasn't
working correctly because I put in a wildcard, which does not work.