mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 16:41:17 +08:00
DEV: Add START_ID
to uploads:downsize
task (#18992)
This commit is contained in:
@ -1088,7 +1088,10 @@ end
|
|||||||
# WORKER_ID/WORKER_COUNT
|
# WORKER_ID/WORKER_COUNT
|
||||||
# When running the script on a single forum in multiple terminals.
|
# When running the script on a single forum in multiple terminals.
|
||||||
# For example, if you want 4 concurrent scripts use WORKER_COUNT=4
|
# For example, if you want 4 concurrent scripts use WORKER_COUNT=4
|
||||||
# and WORKER_ID from 0 to 3
|
# and WORKER_ID from 0 to 3.
|
||||||
|
#
|
||||||
|
# START_ID
|
||||||
|
# Skip uploads with id lower than START_ID.
|
||||||
task "uploads:downsize" => :environment do
|
task "uploads:downsize" => :environment do
|
||||||
min_image_pixels = 500_000 # 0.5 megapixels
|
min_image_pixels = 500_000 # 0.5 megapixels
|
||||||
default_image_pixels = 1_000_000 # 1 megapixel
|
default_image_pixels = 1_000_000 # 1 megapixel
|
||||||
@ -1126,6 +1129,10 @@ task "uploads:downsize" => :environment do
|
|||||||
scope = scope.where("uploads.id % ? = ?", ENV["WORKER_COUNT"], ENV["WORKER_ID"])
|
scope = scope.where("uploads.id % ? = ?", ENV["WORKER_COUNT"], ENV["WORKER_ID"])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if ENV["START_ID"]
|
||||||
|
scope = scope.where("uploads.id >= ?", ENV["START_ID"])
|
||||||
|
end
|
||||||
|
|
||||||
skipped = 0
|
skipped = 0
|
||||||
total_count = scope.count
|
total_count = scope.count
|
||||||
puts "Uploads to process: #{total_count}"
|
puts "Uploads to process: #{total_count}"
|
||||||
|
Reference in New Issue
Block a user