mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: remove memoized values in jobs
This commit is contained in:
parent
b23fc2bf84
commit
9edc490d3f
@ -26,7 +26,7 @@ module Jobs
|
|||||||
end
|
end
|
||||||
|
|
||||||
def badge
|
def badge
|
||||||
@badge ||= Badge.find(Badge::FirstEmoji)
|
Badge.find(Badge::FirstEmoji)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -25,7 +25,7 @@ module Jobs
|
|||||||
end
|
end
|
||||||
|
|
||||||
def badge
|
def badge
|
||||||
@badge ||= Badge.find(Badge::FirstReplyByEmail)
|
Badge.find(Badge::FirstReplyByEmail)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -35,7 +35,7 @@ module Jobs
|
|||||||
end
|
end
|
||||||
|
|
||||||
def badge
|
def badge
|
||||||
@badge ||= Badge.find(Badge::FirstOnebox)
|
Badge.find(Badge::FirstOnebox)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -6,17 +6,19 @@ module Jobs
|
|||||||
def execute(args)
|
def execute(args)
|
||||||
return true unless SiteSetting.notify_about_queued_posts_after > 0 && SiteSetting.contact_email
|
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
|
queued_post_ids = should_notify_ids
|
||||||
message = PendingQueuedPostsMailer.notify(count: should_notify_ids.size)
|
|
||||||
|
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
|
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
|
end
|
||||||
|
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
def should_notify_ids
|
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
|
end
|
||||||
|
|
||||||
def last_notified_id
|
def last_notified_id
|
||||||
@ -28,7 +30,7 @@ module Jobs
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.last_notified_key
|
def self.last_notified_key
|
||||||
"last_notified_queued_post_id"
|
"last_notified_queued_post_id".freeze
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -19,7 +19,7 @@ module Jobs
|
|||||||
end
|
end
|
||||||
|
|
||||||
def feed_key
|
def feed_key
|
||||||
@feed_key ||= "feed-modified:#{Digest::SHA1.hexdigest(SiteSetting.feed_polling_url)}"
|
"feed-modified:#{Digest::SHA1.hexdigest(SiteSetting.feed_polling_url)}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def poll_feed
|
def poll_feed
|
||||||
|
Loading…
Reference in New Issue
Block a user