mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 18:13:38 +08:00
FIX: remove memoized values in jobs
This commit is contained in:
parent
b23fc2bf84
commit
9edc490d3f
|
@ -26,7 +26,7 @@ module Jobs
|
|||
end
|
||||
|
||||
def badge
|
||||
@badge ||= Badge.find(Badge::FirstEmoji)
|
||||
Badge.find(Badge::FirstEmoji)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -25,7 +25,7 @@ module Jobs
|
|||
end
|
||||
|
||||
def badge
|
||||
@badge ||= Badge.find(Badge::FirstReplyByEmail)
|
||||
Badge.find(Badge::FirstReplyByEmail)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -35,7 +35,7 @@ module Jobs
|
|||
end
|
||||
|
||||
def badge
|
||||
@badge ||= Badge.find(Badge::FirstOnebox)
|
||||
Badge.find(Badge::FirstOnebox)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -6,17 +6,19 @@ module Jobs
|
|||
def execute(args)
|
||||
return true unless SiteSetting.notify_about_queued_posts_after > 0 && SiteSetting.contact_email
|
||||
|
||||
if should_notify_ids.size > 0 && last_notified_id.to_i < should_notify_ids.max
|
||||
message = PendingQueuedPostsMailer.notify(count: should_notify_ids.size)
|
||||
queued_post_ids = should_notify_ids
|
||||
|
||||
if queued_post_ids.size > 0 && last_notified_id.to_i < queued_post_ids.max
|
||||
message = PendingQueuedPostsMailer.notify(count: queued_post_ids.size)
|
||||
Email::Sender.new(message, :pending_queued_posts_reminder).send
|
||||
self.last_notified_id = should_notify_ids.max
|
||||
self.last_notified_id = queued_post_ids.max
|
||||
end
|
||||
|
||||
true
|
||||
end
|
||||
|
||||
def should_notify_ids
|
||||
@_should_notify_ids ||= QueuedPost.new_posts.visible.where('created_at < ?', SiteSetting.notify_about_queued_posts_after.hours.ago).pluck(:id)
|
||||
QueuedPost.new_posts.visible.where('created_at < ?', SiteSetting.notify_about_queued_posts_after.hours.ago).pluck(:id)
|
||||
end
|
||||
|
||||
def last_notified_id
|
||||
|
@ -28,7 +30,7 @@ module Jobs
|
|||
end
|
||||
|
||||
def self.last_notified_key
|
||||
"last_notified_queued_post_id"
|
||||
"last_notified_queued_post_id".freeze
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -19,7 +19,7 @@ module Jobs
|
|||
end
|
||||
|
||||
def feed_key
|
||||
@feed_key ||= "feed-modified:#{Digest::SHA1.hexdigest(SiteSetting.feed_polling_url)}"
|
||||
"feed-modified:#{Digest::SHA1.hexdigest(SiteSetting.feed_polling_url)}"
|
||||
end
|
||||
|
||||
def poll_feed
|
||||
|
|
Loading…
Reference in New Issue
Block a user