@@ -38,26 +38,35 @@ impl AuctionOrchestrator {
3838 self . providers . len ( )
3939 }
4040
41- /// Execute an auction using the configured strategy.
41+ /// Execute an auction using the auto-detected strategy.
42+ ///
43+ /// Strategy is determined by mediator configuration:
44+ /// - If mediator is configured: runs parallel mediation (bidders → mediator decides)
45+ /// - If no mediator: runs parallel only (bidders → highest CPM wins)
4246 pub async fn run_auction (
4347 & self ,
4448 request : & AuctionRequest ,
4549 context : & AuctionContext < ' _ > ,
4650 ) -> Result < OrchestrationResult , Report < TrustedServerError > > {
4751 let start_time = Instant :: now ( ) ;
4852
49- log:: info!( "Running auction with strategy: {}" , self . config. strategy) ;
53+ // Auto-detect strategy based on mediator configuration
54+ let ( strategy_name, result) = if self . config . has_mediator ( ) {
55+ (
56+ "parallel_mediation" ,
57+ self . run_parallel_mediation ( request, context) . await ?,
58+ )
59+ } else {
60+ (
61+ "parallel_only" ,
62+ self . run_parallel_only ( request, context) . await ?,
63+ )
64+ } ;
5065
51- let result = match self . config . strategy . as_str ( ) {
52- "parallel_mediation" => self . run_parallel_mediation ( request, context) . await ,
53- "parallel_only" => self . run_parallel_only ( request, context) . await ,
54- strategy => Err ( Report :: new ( TrustedServerError :: Auction {
55- message : format ! (
56- "Unknown auction strategy '{}'. Valid strategies: parallel_mediation, parallel_only" ,
57- strategy
58- ) ,
59- } ) ) ,
60- } ?;
66+ log:: info!(
67+ "Running auction with strategy: {} (auto-detected from mediator config)" ,
68+ strategy_name
69+ ) ;
6170
6271 Ok ( OrchestrationResult {
6372 total_time_ms : start_time. elapsed ( ) . as_millis ( ) as u64 ,
@@ -429,7 +438,6 @@ mod tests {
429438 async fn test_no_bidders_configured ( ) {
430439 let config = AuctionConfig {
431440 enabled : true ,
432- strategy : "parallel_only" . to_string ( ) ,
433441 bidders : vec ! [ ] ,
434442 mediator : None ,
435443 timeout_ms : 2000 ,
0 commit comments