diff --git a/.env.example b/.env.example index 5fe1259..9100363 100644 --- a/.env.example +++ b/.env.example @@ -24,4 +24,4 @@ AWS_SECRET_ACCESS_KEY= AWS_ENDPOINT_URL= AWS_BUCKET_NAME= SERVICE_READINESS_TIMEOUT=60 -RUST_LOG=performance_service=info \ No newline at end of file +RUST_LOG=performance_service=info diff --git a/src/api/routes/calculate.rs b/src/api/routes/calculate.rs index 2f755d9..43a7eba 100644 --- a/src/api/routes/calculate.rs +++ b/src/api/routes/calculate.rs @@ -49,11 +49,13 @@ async fn calculate_relax_pp( let mut pp = round(result.pp as f32, 2); if pp.is_infinite() || pp.is_nan() { + log::warn!("Calculated pp is infinite or NaN, setting to 0"); pp = 0.0; } let mut stars = round(result.difficulty.stars as f32, 2); if stars.is_infinite() || stars.is_nan() { + log::warn!("Calculated star rating is infinite or NaN, setting to 0"); stars = 0.0; } @@ -91,11 +93,13 @@ async fn calculate_rosu_pp( let mut pp = round(result.pp() as f32, 2); if pp.is_infinite() || pp.is_nan() { + log::warn!("Calculated pp is infinite or NaN, setting to 0"); pp = 0.0; } let mut stars = round(result.stars() as f32, 2); if stars.is_infinite() || stars.is_nan() { + log::warn!("Calculated star rating is infinite or NaN, setting to 0"); stars = 0.0; } @@ -142,9 +146,6 @@ async fn calculate_play( for request in requests { let raw_result = if request.mods & RX > 0 && request.mode == 0 { calculate_relax_pp(&request, ctx.clone()).await - } else { - calculate_rosu_pp(&request, ctx.clone()).await - }; let result = match raw_result { Ok(result) => result, @@ -157,6 +158,11 @@ async fn calculate_play( }, }; + log::info!( + "Calculated performance: {}pp for beatmap {}", + result.pp, + request.beatmap_id + ); results.push(result); }