diff --git a/lib/tasks/statistic_subject_info.rake b/lib/tasks/statistic_subject_info.rake index 330ebf629..402be454b 100644 --- a/lib/tasks/statistic_subject_info.rake +++ b/lib/tasks/statistic_subject_info.rake @@ -48,7 +48,7 @@ namespace :subjects do end subjects.find_in_batches(batch_size: 50) do |s| str = [] - Parallel.each(s, in_processes: 4) do |subject| + Parallel.each(s, in_threads: 4) do |subject| puts("---------------------course_info_statistic: #{subject.id}") Rails.logger.info("---------------------course_info_statistic: #{subject.id}") data = Subjects::CourseUsedInfoService.call(subject) @@ -57,6 +57,7 @@ namespace :subjects do str << ("(#{subject.id}, #{key[:school_id]}, '#{key[:school_name]}', #{key[:course_count]}, " + "#{key[:student_count]}, #{key[:choice_shixun_num]}, #{key[:choice_shixun_frequency]}, " + "'#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')") + puts "str: #{str}" if str.size == 1000 sql = "REPLACE INTO subject_course_records(#{column_value}) VALUES #{str.uniq.join(",")}" str_c = str