Skip to content

Commit

Permalink
[Trivial] log deadline (#2221)
Browse files Browse the repository at this point in the history
# Description
Despite increasing the auction-solving share the average solving time
for external solvers didn't increase. This PR adds a debug log that
should allow us further pin down where the issue lies.

# Changes
<!-- List of detailed changes (how the change is accomplished) -->

- [x] Print deadline when it is computed

## How to test
Observe log statement locally.

## Related Issues
#2211
  • Loading branch information
fleupold authored Dec 29, 2023
1 parent c509f76 commit e003c05
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
7 changes: 5 additions & 2 deletions crates/driver/src/domain/time.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use {
crate::infra::{
observe,
solver::Timeouts,
{self},
},
Expand All @@ -20,15 +21,17 @@ pub struct Deadline {
impl Deadline {
pub fn new(deadline: chrono::DateTime<chrono::Utc>, timeouts: Timeouts) -> Self {
let deadline = deadline - timeouts.http_delay;
Self {
let deadline = Self {
driver: deadline,
solvers: {
let now = infra::time::now();
let duration = deadline - now;
now + duration * (timeouts.solving_share_of_deadline.get() * 100.0).round() as i32
/ 100
},
}
};
observe::deadline(&deadline, &timeouts);
deadline
}

/// Remaining time until the deadline for driver to return solution to
Expand Down
7 changes: 6 additions & 1 deletion crates/driver/src/infra/observe/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//! and update the metrics, if the event is worth measuring.
use {
super::{simulator, Ethereum, Mempool},
super::{simulator, solver::Timeouts, Ethereum, Mempool},
crate::{
boundary,
domain::{
Expand All @@ -18,6 +18,7 @@ use {
eth::{self, Gas},
mempools,
quote::{self, Quote},
time::Deadline,
Liquidity,
},
infra::solver,
Expand Down Expand Up @@ -365,6 +366,10 @@ fn competition_error(err: &competition::Error) -> &'static str {
}
}

pub fn deadline(deadline: &Deadline, timeouts: &Timeouts) {
tracing::debug!(?deadline, ?timeouts, "computed deadline");
}

#[derive(Debug)]
pub enum OrderExcludedFromAuctionReason {
CouldNotFetchBalance,
Expand Down

0 comments on commit e003c05

Please sign in to comment.