mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
PERF: ensure we run full GC on contexts
Prior to this change we would never clear memory from contexts and rely on V8 reacting to pressure This could lead to bloating of PrettyText and Transpiler contexts This optimisations ensures that we will clear memory 2 seconds after the last eval on the context
This commit is contained in:
@@ -79,7 +79,7 @@ class DiscourseJsProcessor
|
||||
|
||||
def self.create_new_context
|
||||
# timeout any eval that takes longer than 15 seconds
|
||||
ctx = MiniRacer::Context.new(timeout: 15000)
|
||||
ctx = MiniRacer::Context.new(timeout: 15000, ensure_gc_after_idle: 2000)
|
||||
ctx.eval("var self = this; #{File.read("#{Rails.root}/vendor/assets/javascripts/babel.js")}")
|
||||
ctx.eval(File.read(Ember::Source.bundled_path_for('ember-template-compiler.js')))
|
||||
ctx.eval("module = {}; exports = {};")
|
||||
|
||||
Reference in New Issue
Block a user