Open fsateler opened 3 years ago
Hi Felipe, that's a good observation.
SecureRandom.uuid
might cover up problems when threads are not properly initializedA possible solution would be to have the main thread use true
unless specified, and raise an error for any child threads that are not explicitly initialized.
Thanks!
Hi,
I was bit recently by a bug because a thread (created by a library) did not properly initialize
current_store_id
. I added a monkey patch to add that, and all is working well now.However, this got me thinking: why is it possible for
current_store_id
to ever returnnil
? I believe the safer default is to always set toSecureRandom.uuid
if uninitialized:The current default basically makes all the spawned threads share a store between them, but separate from the main thread.
It may be an even safer default to raise an error when the request store is unset. It probably means a thread was spawned without proper setup/teardown