Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions zeeguu/api/endpoints/friends.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,17 @@ def _generate_recipient_derivative(article, recipient, delivery_language, level)
log(f"share to user_id={recipient.id}: derivative generation failed; "
f"recipient will open the canonical article")
return None

# Warm the reader's tokenization cache now, in this same background job, so
# the recipient's first open is instant instead of paying the Stanza/MWE
# tokenization cost then. get_tokenized_content() caches on a miss. Best
# effort — a warm-up failure must not fail the share.
try:
derivative.get_tokenized_content()
except Exception as e:
log(f"share to user_id={recipient.id}: tokenization warm-up failed "
f"(non-fatal): {e}")

return derivative.id


Expand Down
Loading