liquid
liquid copied to clipboard
The inclusions of .errors makes Liquid::Template non thread-safe?
Hey All,
Since one of the core goals of liquid is to be a compilable resource, it would be assumed that one would use it something like this
# During application warmup
template = Liquid::Template.parse(something)
# And then, during runtime, in many different code paths
template.render({foo: "bar"})
template.render({foo: "baz})
However, since templates sets errors, this makes it inherently thread-unsafe. However, render! seems to be safer (all threads will set @rethrow_errors = true, and bubble up exceptions without any mutation)
Is this by design? Or am i doing something wrong?
Indeed render still does:
ensure
@errors = context.errors
end