fetch: add trace logging to fetch protocol
Log the following at the trace level: - Receiving the pack along with the amount of time it took - The closing of the connection Also organising the imports, while in the neighbourhood. Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com> X-Clacks-Overhead: GNU Terry Pratchett
This commit is contained in:
parent
f038b7ee5c
commit
72c715016f
|
|
@ -1,23 +1,21 @@
|
||||||
use std::{
|
use std::borrow::Cow;
|
||||||
borrow::Cow,
|
use std::io;
|
||||||
io::{self, BufRead},
|
use std::io::BufRead;
|
||||||
path::PathBuf,
|
use std::path::PathBuf;
|
||||||
sync::{atomic::AtomicBool, Arc},
|
use std::sync::{atomic::AtomicBool, Arc};
|
||||||
};
|
|
||||||
|
|
||||||
use gix_features::progress::NestedProgress;
|
use gix_features::progress::NestedProgress;
|
||||||
use gix_pack as pack;
|
use gix_pack as pack;
|
||||||
use gix_protocol::{
|
use gix_protocol::fetch;
|
||||||
fetch::{self, Delegate, DelegateBlocking},
|
use gix_protocol::fetch::{Delegate, DelegateBlocking};
|
||||||
handshake::{self, Ref},
|
use gix_protocol::handshake;
|
||||||
ls_refs, FetchConnection,
|
use gix_protocol::handshake::Ref;
|
||||||
};
|
use gix_protocol::ls_refs;
|
||||||
use gix_transport::{
|
use gix_protocol::FetchConnection;
|
||||||
bstr::BString,
|
use gix_transport::bstr::BString;
|
||||||
client,
|
use gix_transport::client;
|
||||||
client::{ExtendedBufRead, MessageKind},
|
use gix_transport::client::{ExtendedBufRead, MessageKind};
|
||||||
Protocol,
|
use gix_transport::Protocol;
|
||||||
};
|
|
||||||
|
|
||||||
use super::{agent_name, indicate_end_of_interaction, Connection, WantsHaves};
|
use super::{agent_name, indicate_end_of_interaction, Connection, WantsHaves};
|
||||||
|
|
||||||
|
|
@ -253,6 +251,7 @@ where
|
||||||
if !sideband_all {
|
if !sideband_all {
|
||||||
setup_remote_progress(progress, &mut reader);
|
setup_remote_progress(progress, &mut reader);
|
||||||
}
|
}
|
||||||
|
let timer = std::time::Instant::now();
|
||||||
// TODO: remove delegate in favor of functional style to fix progress-hack,
|
// TODO: remove delegate in favor of functional style to fix progress-hack,
|
||||||
// needed as it needs `'static`. As the top-level seems to pass `Discard`,
|
// needed as it needs `'static`. As the top-level seems to pass `Discard`,
|
||||||
// there should be no repercussions right now.
|
// there should be no repercussions right now.
|
||||||
|
|
@ -262,6 +261,7 @@ where
|
||||||
&[],
|
&[],
|
||||||
&response,
|
&response,
|
||||||
)?;
|
)?;
|
||||||
|
log::trace!(target: "fetch", "Received pack ({}ms)", timer.elapsed().as_millis());
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
reader.stopped_at(),
|
reader.stopped_at(),
|
||||||
None,
|
None,
|
||||||
|
|
@ -286,6 +286,7 @@ where
|
||||||
if matches!(protocol, Protocol::V2)
|
if matches!(protocol, Protocol::V2)
|
||||||
&& matches!(conn.mode, FetchConnection::TerminateOnSuccessfulCompletion)
|
&& matches!(conn.mode, FetchConnection::TerminateOnSuccessfulCompletion)
|
||||||
{
|
{
|
||||||
|
log::trace!(target: "fetch", "Indicating end of interaction");
|
||||||
indicate_end_of_interaction(&mut conn)?;
|
indicate_end_of_interaction(&mut conn)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue