Class: Jobs::CheckOutOfDateThemes

Inherits:
Scheduled show all
Defined in:
app/jobs/scheduled/check_out_of_date_themes.rb

Instance Method Summary collapse

Methods inherited from Scheduled

#perform

Methods inherited from Base

acquire_cluster_concurrency_lock!, clear_cluster_concurrency_lock!, cluster_concurrency, cluster_concurrency_redis_key, delayed_perform, #error_context, get_cluster_concurrency, #last_db_duration, #log, #perform, #perform_immediately

Instance Method Details

#execute(args) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/jobs/scheduled/check_out_of_date_themes.rb', line 7

def execute(args)
  target_themes =
    RemoteTheme
      .joins("JOIN themes ON themes.remote_theme_id = remote_themes.id")
      .where.not(remote_url: "")

  target_themes.each do |remote|
    Discourse.capture_exceptions(message: "Error updating theme #{remote.id}") do
      remote.update_remote_version
      remote.save!
    end
  end
end