mirror of
https://github.com/discourse/discourse.git
synced 2025-06-02 04:08:41 +08:00
FIX: generate_topic_thumbnails job infinitely running for corrupted images
It's possible that the original topic image is broken in some form, so we shouldn't try and generate a topic thumbnail for it. The fix will prevent the generate_topic_thumbnails job being enqueued every time the topic is viewed.
This commit is contained in:
@ -115,6 +115,8 @@ class Topic < ActiveRecord::Base
|
||||
image_upload &&
|
||||
SiteSetting.create_thumbnails &&
|
||||
image_upload.filesize < SiteSetting.max_image_size_kb.kilobytes &&
|
||||
image_upload.read_attribute(:width) &&
|
||||
image_upload.read_attribute(:height) &&
|
||||
enqueue_if_missing &&
|
||||
Discourse.redis.set(thumbnail_job_redis_key([]), 1, nx: true, ex: 1.minute)
|
||||
Jobs.enqueue(:generate_topic_thumbnails, { topic_id: id })
|
||||
|
Reference in New Issue
Block a user