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
def95dd3
Verified
Commit
def95dd3
authored
3 years ago
by
Alexander Olofsson
Browse files
Options
Downloads
Patches
Plain Diff
api: Add in-flight request tracking
parent
8d974a6e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/matrix_sdk/api.rb
+8
-0
8 additions, 0 deletions
lib/matrix_sdk/api.rb
with
8 additions
and
0 deletions
lib/matrix_sdk/api.rb
+
8
−
0
View file @
def95dd3
...
@@ -67,6 +67,7 @@ module MatrixSdk
...
@@ -67,6 +67,7 @@ module MatrixSdk
@global_headers
.
merge!
(
params
.
fetch
(
:global_headers
))
if
params
.
key?
:global_headers
@global_headers
.
merge!
(
params
.
fetch
(
:global_headers
))
if
params
.
key?
:global_headers
@synapse
=
params
.
fetch
(
:synapse
,
true
)
@synapse
=
params
.
fetch
(
:synapse
,
true
)
@http
=
nil
@http
=
nil
@inflight
=
[]
self
.
threadsafe
=
params
.
fetch
(
:threadsafe
,
:multithread
)
self
.
threadsafe
=
params
.
fetch
(
:threadsafe
,
:multithread
)
...
@@ -301,6 +302,7 @@ module MatrixSdk
...
@@ -301,6 +302,7 @@ module MatrixSdk
loc_http
=
http
loc_http
=
http
perform_request
=
proc
do
perform_request
=
proc
do
@inflight
<<
loc_http
dur_start
=
Time
.
now
dur_start
=
Time
.
now
response
=
loc_http
.
request
req_obj
response
=
loc_http
.
request
req_obj
dur_end
=
Time
.
now
dur_end
=
Time
.
now
...
@@ -308,6 +310,8 @@ module MatrixSdk
...
@@ -308,6 +310,8 @@ module MatrixSdk
rescue
EOFError
rescue
EOFError
logger
.
error
'Socket closed unexpectedly'
logger
.
error
'Socket closed unexpectedly'
raise
raise
ensure
@inflight
.
delete
loc_http
end
end
if
@threadsafe
==
true
if
@threadsafe
==
true
...
@@ -356,6 +360,10 @@ module MatrixSdk
...
@@ -356,6 +360,10 @@ module MatrixSdk
ret
ret
end
end
def
stop_inflight
@inflight
.
each
(
&
:finish
)
end
private
private
def
construct_request
(
method
:,
url
:,
**
options
)
def
construct_request
(
method
:,
url
:,
**
options
)
...
...
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