Skip to content

A platform for community discussion. Free, open, simple.

PERF: run ImageMagick conversions with nice 10

Sam7e4a43afc664
diff --git a/app/models/optimized_image.rb b/app/models/optimized_image.rb
index 2b5f9864e86..5e67cb84047 100644
--- a/app/models/optimized_image.rb
+++ b/app/models/optimized_image.rb
@@ -330,7 +330,7 @@ class OptimizedImage < ActiveRecord::Base
MAX_PNGQUANT_SIZE = 500_000
def self.convert_with(instructions, to, opts = {})
- Discourse::Utils.execute_command(*instructions)
+ Discourse::Utils.execute_command("nice", "-n", "10", *instructions)
allow_pngquant = to.downcase.ends_with?(".png") && File.size(to) < MAX_PNGQUANT_SIZE
FileHelper.optimize_image!(to, allow_pngquant: allow_pngquant)