addressing ai comments

This commit is contained in:
benedettadavico
2026-05-11 09:34:44 +02:00
parent d37b4226d0
commit 1532c0c16e
5 changed files with 20 additions and 8 deletions
@@ -55,14 +55,15 @@ pub(crate) async fn run_ports_check(
let credentials_args = common::credential_args_from(testrun.ticket_materials);
log_capture.start();
let port_check_result = nym_gateway_probe::Probe::run_ports_for_agent(
let port_check_result_res = nym_gateway_probe::Probe::run_ports_for_agent(
gateway_identity_pubkey,
network,
&run_ports_config,
credentials_args,
)
.await?;
.await;
let probe_log = log_capture.stop_and_drain();
let port_check_result = port_check_result_res?;
submit_ports_check_results_to_servers(
servers,
@@ -48,8 +48,9 @@ pub(crate) async fn run_probe(
// Run the probe, capturing all tracing output
log_capture.start();
let probe_result = Box::pin(probe.probe_run_agent(credentials_args)).await?;
let probe_result_res = Box::pin(probe.probe_run_agent(credentials_args)).await;
let probe_log = log_capture.stop_and_drain();
let probe_result = probe_result_res?;
// Inspect the probe output for socks5 field
match probe_result.outcome.socks5.as_ref() {
@@ -4,6 +4,7 @@ UPDATE gateways
SET ports_check = (last_probe_result::jsonb -> 'ports_check')
WHERE last_probe_result IS NOT NULL
AND btrim(last_probe_result) <> ''
AND last_probe_result ~ '^[\[{]'
AND last_probe_result::jsonb ? 'ports_check'
AND ports_check IS NULL;
@@ -11,4 +12,5 @@ UPDATE gateways
SET last_probe_result = (last_probe_result::jsonb - 'ports_check')::text
WHERE last_probe_result IS NOT NULL
AND btrim(last_probe_result) <> ''
AND last_probe_result ~ '^[\[{]'
AND last_probe_result::jsonb ? 'ports_check';
@@ -82,7 +82,7 @@ pub(crate) struct Cli {
#[arg(value_parser = parse_duration_std)]
pub(crate) testruns_refresh_interval: Duration,
/// 2 hour safety net for test runs which include a port check
/// Safety net for stale in-progress testruns (whole seconds, es. 7200).
#[clap(
long,
default_value = "7200",
@@ -69,8 +69,12 @@ impl NsApiClient {
}
serde_json::from_str(&response_text)
.map(|testrun| {
tracing::info!("Received testrun assignment: {:?}", testrun);
.map(|testrun: TestrunAssignmentWithTickets| {
tracing::info!(
testrun_id = testrun.assignment.testrun_id,
gateway = %testrun.assignment.gateway_identity_key,
"Received testrun assignment",
);
testrun
})
.map_err(|err| {
@@ -115,8 +119,12 @@ impl NsApiClient {
}
serde_json::from_str(&response_text)
.map(|testrun| {
tracing::info!("Received ports-check testrun assignment: {:?}", testrun);
.map(|testrun: TestrunAssignmentWithTickets| {
tracing::info!(
testrun_id = testrun.assignment.testrun_id,
gateway = %testrun.assignment.gateway_identity_key,
"Received ports-check testrun assignment",
);
testrun
})
.map_err(|err| {