Skip to content

Commit 18275e6

Browse files
committed
config processing executing code before config processing is done
This appears to be a strange coincidence that when config[:reconnect] was moved from https://github.com/jruby/activerecord-jdbc-adapter/blob/64157d6e5dfcd64471249d797f87dc1bd255a373/lib/arjdbc/mysql/connection_methods.rb#L65 it lost the local variable 'reconnect' and it changed to calling the method 'reconnect'. Creating this method early would cause default mysql config to crash since the @connection_parameters was not yet defined.
1 parent 93bf542 commit 18275e6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/arjdbc/mysql/adapter_hash_config.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ def build_properties(config)
6161

6262
properties["connectionCollation"] ||= config[:collation] if config[:collation]
6363

64-
properties["autoReconnect"] ||= reconnect.to_s unless config[:reconnect].nil?
64+
reconnect = config[:reconnect]
65+
properties["autoReconnect"] ||= reconnect.to_s unless reconnect.nil?
6566

6667
properties["noDatetimeStringSync"] = true unless properties.key?("noDatetimeStringSync")
6768

0 commit comments

Comments
 (0)