diff --git a/lib/tasks/assets.rake b/lib/tasks/assets.rake index 8b360032771..7f7b8fc2d98 100644 --- a/lib/tasks/assets.rake +++ b/lib/tasks/assets.rake @@ -325,14 +325,11 @@ task "assets:precompile:theme_transpiler": "environment" do end # Run these tasks **before** Rails' "assets:precompile" task -task "assets:precompile": %w[ - assets:precompile:before - maxminddb:refresh - assets:precompile:theme_transpiler - ] +task "assets:precompile": %w[assets:precompile:before assets:precompile:theme_transpiler] # Run these tasks **after** Rails' "assets:precompile" task Rake::Task["assets:precompile"].enhance do Rake::Task["assets:precompile:compress_js"].invoke Rake::Task["assets:precompile:css"].invoke + Rake::Task["maxminddb:refresh"].invoke end diff --git a/lib/tasks/maxminddb.rake b/lib/tasks/maxminddb.rake index 28f0a039128..e0e7966359e 100644 --- a/lib/tasks/maxminddb.rake +++ b/lib/tasks/maxminddb.rake @@ -64,25 +64,21 @@ task "maxminddb:refresh": "environment" do puts "Downloading MaxMindDB..." - maxmind_thread = - Thread.new do - name = "unknown" - begin - GEOLITE_DBS.each do |db| - name = db - DiscourseIpInfo.mmdb_download(db) - end + name = "unknown" - if GlobalSetting.maxmind_backup_path.present? - copy_maxmind(DiscourseIpInfo.path, GlobalSetting.maxmind_backup_path) - end - rescue OpenURI::HTTPError => e - STDERR.puts("*" * 100) - STDERR.puts("MaxMindDB (#{name}) could not be downloaded: #{e}") - STDERR.puts("*" * 100) - Rails.logger.warn("MaxMindDB (#{name}) could not be downloaded: #{e}") - end + begin + GEOLITE_DBS.each do |db| + name = db + DiscourseIpInfo.mmdb_download(db) end - at_exit { maxmind_thread.join } + if GlobalSetting.maxmind_backup_path.present? + copy_maxmind(DiscourseIpInfo.path, GlobalSetting.maxmind_backup_path) + end + rescue OpenURI::HTTPError => e + STDERR.puts("*" * 100) + STDERR.puts("MaxMindDB (#{name}) could not be downloaded: #{e}") + STDERR.puts("*" * 100) + Rails.logger.warn("MaxMindDB (#{name}) could not be downloaded: #{e}") + end end