mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 03:40:00 +08:00
FIX: Limit concurrent assets:precompile
to number of available cores.
This commit is contained in:
parent
23b4ab9bf9
commit
13dde44c72
|
@ -151,9 +151,11 @@ def compress(from, to)
|
|||
end
|
||||
|
||||
def concurrent?
|
||||
executor = Concurrent::FixedThreadPool.new(Concurrent.processor_count)
|
||||
|
||||
if ENV["SPROCKETS_CONCURRENT"] == "1"
|
||||
concurrent_compressors = []
|
||||
yield(Proc.new { |&block| concurrent_compressors << Concurrent::Future.execute { block.call } })
|
||||
yield(Proc.new { |&block| concurrent_compressors << Concurrent::Future.execute(executor: executor) { block.call } })
|
||||
concurrent_compressors.each(&:wait!)
|
||||
else
|
||||
yield(Proc.new { |&block| block.call })
|
||||
|
|
Loading…
Reference in New Issue
Block a user