Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
threads << do ActiveRecord::Base.connection_pool.with_connection do
# needed because otherwise the connection pool can run
# out of connections
t = Thread.current
t[:variable_name] = Model.find_by(column: data)
joined_threads = &:join
# do something with the thread local variable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.