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
22b123de
Commit
22b123de
authored
11 months ago
by
Jason Volk
Committed by
🥺
11 months ago
Browse files
Options
Downloads
Patches
Plain Diff
improve tracing attributes in sending stack.
Signed-off-by:
Jason Volk
<
jason@zemos.net
>
parent
a87e7d8e
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
src/service/sending/mod.rs
+10
-10
10 additions, 10 deletions
src/service/sending/mod.rs
src/service/sending/send.rs
+4
-2
4 additions, 2 deletions
src/service/sending/send.rs
with
14 additions
and
12 deletions
src/service/sending/mod.rs
+
10
−
10
View file @
22b123de
...
...
@@ -224,17 +224,17 @@ pub fn cleanup_events(&self, appservice_id: String) -> Result<()> {
Ok
(())
}
#[tracing::instrument(skip(self,
destination,
request
)
)]
pub
async
fn
send_federation_request
<
T
>
(
&
self
,
dest
ination
:
&
ServerName
,
request
:
T
)
->
Result
<
T
::
IncomingResponse
>
#[tracing::instrument(skip(self,
request),
name
=
"
request
"
)]
pub
async
fn
send_federation_request
<
T
>
(
&
self
,
dest
:
&
ServerName
,
request
:
T
)
->
Result
<
T
::
IncomingResponse
>
where
T
:
OutgoingRequest
+
Debug
,
{
let
permit
=
self
.maximum_requests
.acquire
()
.await
;
let
timeout
=
Duration
::
from_secs
(
self
.timeout
);
let
response
=
tokio
::
time
::
timeout
(
timeout
,
send
::
send_request
(
dest
ination
,
request
))
let
response
=
tokio
::
time
::
timeout
(
timeout
,
send
::
send_request
(
dest
,
request
))
.await
.map_err
(|
_
|
{
warn!
(
"Timeout after 300 seconds waiting for server response of {dest
ination
}"
);
warn!
(
"Timeout after 300 seconds waiting for server response of {dest}"
);
Error
::
BadServerResponse
(
"Timeout after 300 seconds waiting for server response"
)
})
?
;
drop
(
permit
);
...
...
@@ -269,6 +269,7 @@ pub fn start_handler(self: &Arc<Self>) {
});
}
#[tracing::instrument(skip(self),
name
=
"sender"
)]
async
fn
handler
(
&
self
)
->
Result
<
()
>
{
let
mut
receiver
=
self
.receiver
.lock
()
.await
;
...
...
@@ -583,7 +584,6 @@ pub fn select_edus_receipts(
Ok
(
true
)
}
#[tracing::instrument(skip(events,
kind))]
async
fn
handle_events
(
kind
:
OutgoingKind
,
events
:
Vec
<
SendingEventType
>
,
)
->
Result
<
OutgoingKind
,
(
OutgoingKind
,
Error
)
>
{
...
...
@@ -743,9 +743,9 @@ async fn handle_events_kind_push(
Ok
(
kind
.clone
())
}
#[tracing::instrument(skip(kind,
events))]
#[tracing::instrument(skip(kind,
events)
,
name
=
""
)]
async
fn
handle_events_kind_normal
(
kind
:
&
OutgoingKind
,
server
:
&
OwnedServerName
,
events
:
Vec
<
SendingEventType
>
,
kind
:
&
OutgoingKind
,
dest
:
&
OwnedServerName
,
events
:
Vec
<
SendingEventType
>
,
)
->
Result
<
OutgoingKind
,
(
OutgoingKind
,
Error
)
>
{
let
mut
edu_jsons
=
Vec
::
new
();
let
mut
pdu_jsons
=
Vec
::
new
();
...
...
@@ -761,7 +761,7 @@ async fn handle_events_kind_normal(
.get_pdu_json_from_id
(
pdu_id
)
.map_err
(|
e
|
(
kind
.clone
(),
e
))
?
.ok_or_else
(||
{
error!
(
"event not found: {
server
} {pdu_id:?}"
);
error!
(
"event not found: {
dest
} {pdu_id:?}"
);
(
kind
.clone
(),
Error
::
bad_database
(
"[Normal] Event in servernamevent_datas not found in db."
),
...
...
@@ -784,7 +784,7 @@ async fn handle_events_kind_normal(
let
permit
=
services
()
.sending.maximum_requests
.acquire
()
.await
;
let
response
=
send
::
send_request
(
server
,
dest
,
send_transaction_message
::
v1
::
Request
{
origin
:
services
()
.globals
.server_name
()
.to_owned
(),
pdus
:
pdu_jsons
,
...
...
@@ -806,7 +806,7 @@ async fn handle_events_kind_normal(
.map
(|
response
|
{
for
pdu
in
response
.pdus
{
if
pdu
.1
.is_err
()
{
warn!
(
"Failed to send to {}: {:?}"
,
server
,
pdu
);
warn!
(
"Failed to send to {}: {:?}"
,
dest
,
pdu
);
}
}
kind
.clone
()
...
...
This diff is collapsed.
Click to expand it.
src/service/sending/send.rs
+
4
−
2
View file @
22b123de
...
...
@@ -43,6 +43,7 @@ pub enum FedDest {
Named
(
String
,
String
),
}
#[tracing::instrument(skip_all,
name
=
"send"
)]
pub
(
crate
)
async
fn
send_request
<
T
>
(
destination
:
&
ServerName
,
request
:
T
)
->
Result
<
T
::
IncomingResponse
>
where
T
:
OutgoingRequest
+
Debug
,
...
...
@@ -100,7 +101,7 @@ pub(crate) async fn send_request<T>(destination: &ServerName, request: T) -> Res
}
else
{
write_destination_to_cache
=
true
;
let
result
=
find
_actual_destination
(
destination
)
.await
;
let
result
=
resolve
_actual_destination
(
destination
)
.await
;
(
result
.0
,
result
.1
.into_uri_string
())
};
...
...
@@ -338,7 +339,8 @@ fn add_port_to_hostname(destination_str: &str) -> FedDest {
/// Implemented according to the specification at <https://matrix.org/docs/spec/server_server/r0.1.4#resolving-server-names>
/// Numbers in comments below refer to bullet points in linked section of
/// specification
async
fn
find_actual_destination
(
destination
:
&
'_
ServerName
)
->
(
FedDest
,
FedDest
)
{
#[tracing::instrument(skip_all,
name
=
"resolve"
)]
async
fn
resolve_actual_destination
(
destination
:
&
'_
ServerName
)
->
(
FedDest
,
FedDest
)
{
debug!
(
"Finding actual destination for {destination}"
);
let
destination_str
=
destination
.as_str
()
.to_owned
();
let
mut
hostname
=
destination_str
.clone
();
...
...
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