Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Matrix Ruby SDK
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alexander Olofsson
Matrix Ruby SDK
Commits
c9af6cd6
Verified
Commit
c9af6cd6
authored
5 years ago
by
Alexander Olofsson
Browse files
Options
Downloads
Patches
Plain Diff
Add a setting for the HTTP open timeout value
parent
74ac4f59
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CHANGELOG.md
+1
-0
1 addition, 0 deletions
CHANGELOG.md
lib/matrix_sdk/api.rb
+11
-1
11 additions, 1 deletion
lib/matrix_sdk/api.rb
with
12 additions
and
1 deletion
CHANGELOG.md
+
1
−
0
View file @
c9af6cd6
## 1.4.1 - **Unreleased**
-
Adds error event to the client abstraction, for handling errors in the background listener
-
Adds an
`open_timeout`
setter to the API
-
Fixes an overly aggressive filter for event handlers
## 1.4.0 - 2019-09-30
...
...
This diff is collapsed.
Click to expand it.
lib/matrix_sdk/api.rb
+
11
−
1
View file @
c9af6cd6
...
...
@@ -23,7 +23,7 @@ module MatrixSdk
}.
freeze
attr_accessor
:access_token
,
:connection_address
,
:connection_port
,
:device_id
,
:autoretry
,
:global_headers
attr_reader
:homeserver
,
:validate_certificate
,
:read_timeout
,
:protocols
,
:well_known
,
:proxy_uri
attr_reader
:homeserver
,
:validate_certificate
,
:open_timeout
,
:read_timeout
,
:protocols
,
:well_known
,
:proxy_uri
ignore_inspect
:access_token
,
:logger
...
...
@@ -38,6 +38,7 @@ module MatrixSdk
# @option params [Boolean] :validate_certificate (false) Should the connection require valid SSL certificates
# @option params [Integer] :transaction_id (0) The starting ID for transactions
# @option params [Numeric] :backoff_time (5000) The request backoff time in milliseconds
# @option params [Numeric] :open_timeout (nil) The timeout in seconds to wait for a TCP session to open
# @option params [Numeric] :read_timeout (240) The timeout in seconds for reading responses
# @option params [Hash] :global_headers Additional headers to set for all requests
# @option params [Boolean] :skip_login Should the API skip logging in if the HS URL contains user information
...
...
@@ -63,6 +64,7 @@ module MatrixSdk
@validate_certificate
=
params
.
fetch
(
:validate_certificate
,
false
)
@transaction_id
=
params
.
fetch
(
:transaction_id
,
0
)
@backoff_time
=
params
.
fetch
(
:backoff_time
,
5000
)
@open_timeout
=
params
.
fetch
(
:open_timeout
,
nil
)
@read_timeout
=
params
.
fetch
(
:read_timeout
,
240
)
@well_known
=
params
.
fetch
(
:well_known
,
{})
@global_headers
=
DEFAULT_HEADERS
.
dup
...
...
@@ -155,6 +157,13 @@ module MatrixSdk
protocols
.
include?
protocol
end
# @param seconds [Numeric]
# @return [Numeric]
def
open_timeout
=
(
seconds
)
@http
.
finish
if
@http
&&
@open_timeout
!=
seconds
@open_timeout
=
seconds
end
# @param seconds [Numeric]
# @return [Numeric]
def
read_timeout
=
(
seconds
)
...
...
@@ -291,6 +300,7 @@ module MatrixSdk
Net
::
HTTP
.
new
(
host
,
port
)
end
@http
.
open_timeout
=
open_timeout
@http
.
read_timeout
=
read_timeout
@http
.
use_ssl
=
homeserver
.
scheme
==
'https'
@http
.
verify_mode
=
validate_certificate
?
::
OpenSSL
::
SSL
::
VERIFY_NONE
:
nil
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment