Class: GoodJob::CronDenormalizationStatsManager
- Inherits:
-
HasUtils::GoodJob::BaseWorker
- Object
- HasUtils::GoodJob::BaseWorker
- GoodJob::CronDenormalizationStatsManager
- Includes:
- HasUtils::GoodJob::UniqueJob
- Defined in:
- app/workers/good_job/cron_denormalization_stats_manager.rb
Instance Method Summary collapse
Instance Method Details
#classes_including_module(module_name) ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'app/workers/good_job/cron_denormalization_stats_manager.rb', line 29 def classes_including_module(module_name) # Ensure the module is a constant target_module = module_name.constantize # Get all classes that include the specified module ObjectSpace.each_object(Class).select do |klass| klass.included_modules.include?(target_module) end end |
#perform ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/workers/good_job/cron_denormalization_stats_manager.rb', line 10 def perform classes_including_module("::HasHelpers::DNUtils").each do |clazz| dependencies_class_name = "#{clazz.table_name.camelize}Dependencies" dependencies = dependencies_class_name.safe_constantize next unless dependencies error_query = if dependencies.respond_to?(:error_check_with_limit) batch_size = dependencies.const_defined?(:ERROR_UPDATE_BATCH_SIZE) ? dependencies::ERROR_UPDATE_BATCH_SIZE : 1000 dependencies.error_check_with_limit(batch_size) elsif dependencies.respond_to?(:error_check) dependencies.error_check end next unless error_query ::GoodJob::DenormalizationStatsWorker.perform_later(clazz.table_name, error_query) end end |