We have seen issues running demo mode with concurrency, and traced it to the fact that any config values on the DemoMode class itself are not thread safe and must be pre-heated before threads are spawned.
For example, this line might cause personas to return [] in a thread that had already loaded all of its persona files into memory:
def personas
unless instance_variable_defined?(:@personas)
@personas = []
auto_load_personas!
end
@personas
end
The workaround for now is to preheat this config during application boot explicitly, but we should fix this more sustainably from within the gem itself.
We have seen issues running demo mode with concurrency, and traced it to the fact that any config values on the
DemoModeclass itself are not thread safe and must be pre-heated before threads are spawned.For example, this line might cause
personasto return[]in a thread that had already loaded all of its persona files into memory:The workaround for now is to preheat this config during application boot explicitly, but we should fix this more sustainably from within the gem itself.