mirror of https://github.com/zulip/zulip.git
6f20c15ae9
Messages are rendered outside of a transaction, for performance reasons, and then sent inside of one. This opens thumbnailing up to a race where the thumbnails have not yet been written when the message is rendered, but the message has not been sent when thumbnailing completes, causing `rewrite_thumbnailed_images` to be a no-op and the message being left with a spinner which never resolves. Explicitly lock and use he ImageAttachment data inside the message-sending transaction, to rewrite the message content with the latest information about the existing thumbnails. Despite the thumbnailing worker taking a lock on Message rows to update them, this does not lead to deadlocks -- the INSERT of the Message rows happens in a transaction, ensuring that either the message rending blocks the thumbnailing until the Message row is created, or that the `rewrite_thumbnailed_images` and Message INSERT waits until thumbnailing is complete (and updated no Message rows). |
||
---|---|---|
.. | ||
__init__.py | ||
api_arguments_table_generator.py | ||
api_return_values_table_generator.py | ||
fenced_code.py | ||
help_emoticon_translations_table.py | ||
help_relative_links.py | ||
help_settings_links.py | ||
include.py | ||
nested_code_blocks.py | ||
priorities.py | ||
static.py | ||
tabbed_sections.py |