Skip to content

Commit

Permalink
Store considered order events label for all considered orders (#2870)
Browse files Browse the repository at this point in the history
# Description
While testing the progress bar v2 @alfetopito never saw the `Solved`
state (called `considered` internally).
This state indicates that some solver tries to settle your order, it
just didn't provide the best overall solution. In terms of the progress
bar this means your order will likely soon be settled.

# Changes
It looks like currently we only store the `considered` flag for the
winning solution but not ALL solutions. This PR changes that.
  • Loading branch information
MartinquaXD authored Aug 8, 2024
1 parent f039ebc commit 76b843c
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions crates/autopilot/src/run_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use {
::observe::metrics,
anyhow::Result,
database::order_events::OrderEventLabel,
itertools::Itertools,
model::solver_competition::{
CompetitionAuction,
Order,
Expand Down Expand Up @@ -130,6 +131,14 @@ impl RunLoop {
};
let competition_simulation_block = self.eth.current_block().borrow().number;

let considered_orders = solutions
.iter()
.flat_map(|solution| solution.solution.order_ids().copied())
.unique()
.collect();
self.persistence
.store_order_events(considered_orders, OrderEventLabel::Considered);

// TODO: Keep going with other solutions until some deadline.
if let Some(Participant { driver, solution }) = solutions.last() {
tracing::info!(driver = %driver.name, solution = %solution.id(), "winner");
Expand All @@ -146,10 +155,6 @@ impl RunLoop {
}
};

let order_uids = solution.order_ids().copied().collect();
self.persistence
.store_order_events(order_uids, OrderEventLabel::Considered);

let winner = solution.solver().into();
let winning_score = solution.score().get().0;
let reference_score = solutions
Expand Down

0 comments on commit 76b843c

Please sign in to comment.