Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
conduwuit
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
🥺
conduwuit
Commits
2316d890
Unverified
Commit
2316d890
authored
2 years ago
by
Timo Kösters
Browse files
Options
Downloads
Patches
Plain Diff
Even more logging
parent
bde4880c
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
src/api/server_server.rs
+8
-0
8 additions, 0 deletions
src/api/server_server.rs
with
8 additions
and
0 deletions
src/api/server_server.rs
+
8
−
0
View file @
2316d890
...
@@ -125,6 +125,8 @@ pub(crate) async fn send_request<T: OutgoingRequest>(
...
@@ -125,6 +125,8 @@ pub(crate) async fn send_request<T: OutgoingRequest>(
return
Err
(
Error
::
bad_config
(
"Federation is disabled."
));
return
Err
(
Error
::
bad_config
(
"Federation is disabled."
));
}
}
info!
(
"Preparing to send request to {destination}"
);
let
mut
write_destination_to_cache
=
false
;
let
mut
write_destination_to_cache
=
false
;
let
cached_result
=
services
()
let
cached_result
=
services
()
...
@@ -231,11 +233,13 @@ pub(crate) async fn send_request<T: OutgoingRequest>(
...
@@ -231,11 +233,13 @@ pub(crate) async fn send_request<T: OutgoingRequest>(
let
url
=
reqwest_request
.url
()
.clone
();
let
url
=
reqwest_request
.url
()
.clone
();
info!
(
"Sending request to {destination} at {url}"
);
let
response
=
services
()
let
response
=
services
()
.globals
.globals
.federation_client
()
.federation_client
()
.execute
(
reqwest_request
)
.execute
(
reqwest_request
)
.await
;
.await
;
info!
(
"Received response from {destination} at {url}"
);
match
response
{
match
response
{
Ok
(
mut
response
)
=>
{
Ok
(
mut
response
)
=>
{
...
@@ -251,10 +255,12 @@ pub(crate) async fn send_request<T: OutgoingRequest>(
...
@@ -251,10 +255,12 @@ pub(crate) async fn send_request<T: OutgoingRequest>(
.expect
(
"http::response::Builder is usable"
),
.expect
(
"http::response::Builder is usable"
),
);
);
info!
(
"Getting response bytes from {destination}"
);
let
body
=
response
.bytes
()
.await
.unwrap_or_else
(|
e
|
{
let
body
=
response
.bytes
()
.await
.unwrap_or_else
(|
e
|
{
warn!
(
"server error {}"
,
e
);
warn!
(
"server error {}"
,
e
);
Vec
::
new
()
.into
()
Vec
::
new
()
.into
()
});
// TODO: handle timeout
});
// TODO: handle timeout
info!
(
"Got response bytes from {destination}"
);
if
status
!=
200
{
if
status
!=
200
{
warn!
(
warn!
(
...
@@ -273,6 +279,7 @@ pub(crate) async fn send_request<T: OutgoingRequest>(
...
@@ -273,6 +279,7 @@ pub(crate) async fn send_request<T: OutgoingRequest>(
.expect
(
"reqwest body is valid http body"
);
.expect
(
"reqwest body is valid http body"
);
if
status
==
200
{
if
status
==
200
{
info!
(
"Parsing response bytes from {destination}"
);
let
response
=
T
::
IncomingResponse
::
try_from_http_response
(
http_response
);
let
response
=
T
::
IncomingResponse
::
try_from_http_response
(
http_response
);
if
response
.is_ok
()
&&
write_destination_to_cache
{
if
response
.is_ok
()
&&
write_destination_to_cache
{
services
()
services
()
...
@@ -294,6 +301,7 @@ pub(crate) async fn send_request<T: OutgoingRequest>(
...
@@ -294,6 +301,7 @@ pub(crate) async fn send_request<T: OutgoingRequest>(
Error
::
BadServerResponse
(
"Server returned bad 200 response."
)
Error
::
BadServerResponse
(
"Server returned bad 200 response."
)
})
})
}
else
{
}
else
{
info!
(
"Returning error from {destination}"
);
Err
(
Error
::
FederationError
(
Err
(
Error
::
FederationError
(
destination
.to_owned
(),
destination
.to_owned
(),
RumaError
::
from_http_response
(
http_response
),
RumaError
::
from_http_response
(
http_response
),
...
...
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