patch to safe_fork to catch when the user has no connection before forking
This commit is contained in:
parent
3c71985196
commit
361cd0724a
|
@ -8,7 +8,7 @@ class SafeFork
|
||||||
begin
|
begin
|
||||||
# create a new connection and perform the action
|
# create a new connection and perform the action
|
||||||
begin
|
begin
|
||||||
ActiveRecord::Base.establish_connection(connection.merge({:allow_concurrency => true})) if defined?(ActiveRecord)
|
ActiveRecord::Base.establish_connection((connection || {}).merge({:allow_concurrency => true})) if defined?(ActiveRecord)
|
||||||
rescue ActiveRecord::AdapterNotSpecified
|
rescue ActiveRecord::AdapterNotSpecified
|
||||||
# AR was defined but we didn't have a connection
|
# AR was defined but we didn't have a connection
|
||||||
end
|
end
|
||||||
|
@ -21,7 +21,7 @@ class SafeFork
|
||||||
ensure
|
ensure
|
||||||
# make sure we re-establish the connection before returning to the main instance
|
# make sure we re-establish the connection before returning to the main instance
|
||||||
begin
|
begin
|
||||||
ActiveRecord::Base.establish_connection(connection.merge({:allow_concurrency => true})) if defined?(ActiveRecord)
|
ActiveRecord::Base.establish_connection((connection || {}).merge({:allow_concurrency => true})) if defined?(ActiveRecord)
|
||||||
rescue ActiveRecord::AdapterNotSpecified
|
rescue ActiveRecord::AdapterNotSpecified
|
||||||
# AR was defined but we didn't have a connection
|
# AR was defined but we didn't have a connection
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue