FIX: Infinite loop in migrate_to_s3 rake task

This commit is contained in:
Gerhard Schlager 2020-04-19 20:21:58 +02:00
parent cfe510cbcf
commit baae0e7446

View File

@ -6,6 +6,8 @@ module FileStore
ToS3MigrationError = Class.new(RuntimeError)
class ToS3Migration
MISSING_UPLOADS_RAKE_TASK_NAME ||= 'posts:missing_uploads'
def initialize(s3_options:, dry_run: false, migrate_to_multisite: false, skip_etag_verify: false)
@s3_bucket = s3_options[:bucket]
@ -85,8 +87,8 @@ module FileStore
success = false
end
Discourse::Application.load_tasks
Rake::Task['posts:missing_uploads']
Discourse::Application.load_tasks unless Rake::Task.task_defined?(MISSING_UPLOADS_RAKE_TASK_NAME)
Rake::Task[MISSING_UPLOADS_RAKE_TASK_NAME]
count = DB.query_single(<<~SQL, Post::MISSING_UPLOADS, Post::MISSING_UPLOADS_IGNORED).first
SELECT COUNT(1)
FROM posts p