mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
Revert "FIX: Jobs.cancel_scheduled_job wasn't working anymore due to our move to using multiple queues"
This reverts commit b7c16991f7
.
This commit is contained in:
parent
b7c16991f7
commit
8fcd359e2a
3 changed files with 14 additions and 20 deletions
|
@ -244,10 +244,7 @@ module Jobs
|
||||||
def self.scheduled_for(job_name, params={})
|
def self.scheduled_for(job_name, params={})
|
||||||
params = params.with_indifferent_access
|
params = params.with_indifferent_access
|
||||||
job_class = "Jobs::#{job_name.to_s.camelcase}"
|
job_class = "Jobs::#{job_name.to_s.camelcase}"
|
||||||
|
Sidekiq::ScheduledSet.new.select do |scheduled_job|
|
||||||
scheduled_jobs = []
|
|
||||||
Sidekiq::Queue.all.each do |queue|
|
|
||||||
queue.each do |scheduled_job|
|
|
||||||
if scheduled_job.klass.to_s == job_class
|
if scheduled_job.klass.to_s == job_class
|
||||||
matched = true
|
matched = true
|
||||||
job_params = scheduled_job.item["args"][0].with_indifferent_access
|
job_params = scheduled_job.item["args"][0].with_indifferent_access
|
||||||
|
@ -257,13 +254,12 @@ module Jobs
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
scheduled_jobs << scheduled_job if matched
|
matched
|
||||||
|
else
|
||||||
|
false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
scheduled_jobs
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
Dir["#{Rails.root}/app/jobs/onceoff/*.rb"].each {|file| require_dependency file }
|
Dir["#{Rails.root}/app/jobs/onceoff/*.rb"].each {|file| require_dependency file }
|
||||||
|
|
|
@ -7,10 +7,9 @@ module Jobs
|
||||||
UserAvatar.includes(:user)
|
UserAvatar.includes(:user)
|
||||||
.where(last_gravatar_download_attempt: nil)
|
.where(last_gravatar_download_attempt: nil)
|
||||||
.order("users.last_posted_at DESC")
|
.order("users.last_posted_at DESC")
|
||||||
.find_in_batches(batch_size: 5000) do |user_avatars|
|
.limit(5000)
|
||||||
user_avatars.each do |user_avatar|
|
.each do |u|
|
||||||
user_avatar.user.refresh_avatar
|
u.user.refresh_avatar
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -753,7 +753,6 @@ class User < ActiveRecord::Base
|
||||||
avatar = user_avatar || create_user_avatar
|
avatar = user_avatar || create_user_avatar
|
||||||
|
|
||||||
if SiteSetting.automatically_download_gravatars? && !avatar.last_gravatar_download_attempt
|
if SiteSetting.automatically_download_gravatars? && !avatar.last_gravatar_download_attempt
|
||||||
Jobs.cancel_scheduled_job(:update_gravatar, user_id: self.id, avatar_id: avatar.id)
|
|
||||||
Jobs.enqueue(:update_gravatar, user_id: self.id, avatar_id: avatar.id)
|
Jobs.enqueue(:update_gravatar, user_id: self.id, avatar_id: avatar.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue