Skip to content

Commit

Permalink
Fixed marklogic-community#470: allow overriding http timeout settings…
Browse files Browse the repository at this point in the history
… from props
  • Loading branch information
grtjn committed Jun 29, 2015
1 parent 0d9e53e commit a5f243a
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 6 deletions.
8 changes: 8 additions & 0 deletions deploy/default.properties
Original file line number Diff line number Diff line change
Expand Up @@ -213,3 +213,11 @@ evaler-port=7998
# List of MarkLogic system databases, for replication
#
system-dbs=App-Services,Documents,Extensions,Fab,Last-Login,Meters,Modules,Schemas,Security,Triggers

#
# HTTP connection settings
#
http.retry-count=3
http.open-timeout=5
http.read-timeout=300
http.retry-delay=15
11 changes: 10 additions & 1 deletion deploy/lib/MLClient.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ def initialize(options)
@request = {}

@@no_prompt = options[:no_prompt]
@@http_connection_retry_count = options[:http_connection_retry_count]
@@http_connection_open_timeout = options[:http_connection_open_timeout]
@@http_connection_read_timeout = options[:http_connection_read_timeout]
@@http_connection_retry_delay = options[:http_connection_retry_delay]

end

def MLClient.logger()
Expand All @@ -49,7 +54,11 @@ def logger()
def get_http
if (!@http)
@http = Roxy::Http.new({
:logger => logger
:logger => logger,
:http_connection_retry_count => @@http_connection_retry_count,
:http_connection_open_timeout => @@http_connection_open_timeout,
:http_connection_read_timeout => @@http_connection_read_timeout,
:http_connection_retry_delay => @@http_connection_retry_delay
})
end
@http
Expand Down
6 changes: 5 additions & 1 deletion deploy/lib/ml_rest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ def initialize(options)
@port = options[:app_port]
end
@http = Roxy::Http.new({
:logger => @logger
:logger => @logger,
:http_connection_retry_count => options[:http_connection_retry_count],
:http_connection_open_timeout => options[:http_connection_open_timeout],
:http_connection_read_timeout => options[:http_connection_read_timeout],
:http_connection_retry_delay => options[:http_connection_retry_delay]
})
@request = {}
@gmt_offset = Time.now.gmt_offset
Expand Down
18 changes: 15 additions & 3 deletions deploy/lib/server_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ def initialize(options)
:user_name => @properties["ml.user"],
:password => @properties["ml.password"],
:logger => options[:logger],
:no_prompt => options[:no_prompt]
:no_prompt => options[:no_prompt],
:http_connection_retry_count => @properties["ml.http.retry-count"].to_i,
:http_connection_open_timeout => @properties["ml.http.open-timeout"].to_i,
:http_connection_read_timeout => @properties["ml.http.read-timeout"].to_i,
:http_connection_retry_delay => @properties["ml.http.retry-delay"].to_i
)

@server_version = @properties["ml.server-version"].to_i
Expand Down Expand Up @@ -1694,7 +1698,11 @@ def xcc
:password => @ml_password,
:xcc_server => @hostname,
:xcc_port => @properties["ml.xcc-port"],
:logger => logger
:logger => logger,
:http_connection_retry_count => @properties["ml.http.retry-count"].to_i,
:http_connection_open_timeout => @properties["ml.http.open-timeout"].to_i,
:http_connection_read_timeout => @properties["ml.http.read-timeout"].to_i,
:http_connection_retry_delay => @properties["ml.http.retry-delay"].to_i
})
end
end
Expand All @@ -1708,7 +1716,11 @@ def mlRest
:app_port => @properties["ml.app-port"],
:rest_port => @properties["ml.rest-port"],
:logger => @logger,
:server_version => @server_version
:server_version => @server_version,
:http_connection_retry_count => @properties["ml.http.retry-count"].to_i,
:http_connection_open_timeout => @properties["ml.http.open-timeout"].to_i,
:http_connection_read_timeout => @properties["ml.http.read-timeout"].to_i,
:http_connection_retry_delay => @properties["ml.http.retry-delay"].to_i
})
else
@mlRest
Expand Down
8 changes: 7 additions & 1 deletion deploy/lib/xcc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,13 @@ def initialize(options)
super(options)
@hostname = options[:xcc_server]
@port = options[:xcc_port]
@http = Roxy::Http.new :logger => logger
@http = Roxy::Http.new({
:logger => logger,
:http_connection_retry_count => options[:http_connection_retry_count],
:http_connection_open_timeout => options[:http_connection_open_timeout],
:http_connection_read_timeout => options[:http_connection_read_timeout],
:http_connection_retry_delay => options[:http_connection_retry_delay]
})
@request = {}
@gmt_offset = Time.now.gmt_offset
end
Expand Down

0 comments on commit a5f243a

Please sign in to comment.