Mutate resource_limits hash to flag that the limit was reached (for outside observation)

This commit is contained in:
Florian Weingarten
2013-05-31 09:34:23 -04:00
parent 9075b428b1
commit 2b17e24b16
2 changed files with 9 additions and 1 deletions
+4 -1
View File
@@ -108,7 +108,10 @@ module Liquid
token_output = (token.respond_to?(:render) ? token.render(context) : token)
context.resource_limits[:render_length_current] += (token_output.respond_to?(:length) ? token_output.length : 1)
raise MemoryError.new("Memory limits exceeded") if context.resource_limits_reached?
if context.resource_limits_reached?
context.resource_limits[:reached] = true
raise MemoryError.new("Memory limits exceeded")
end
output << token_output
rescue MemoryError => e
raise e