Refactor change_falukant_user_money: Remove debug logging for money clamping and update execution to reduce noise, maintaining essential logging only when clipping occurs.
This commit is contained in:
@@ -178,12 +178,7 @@ impl BaseWorker {
|
|||||||
// numeric(10,2) allows values with absolute < 10^8 (100_000_000)
|
// numeric(10,2) allows values with absolute < 10^8 (100_000_000)
|
||||||
const MAX_ABS: f64 = 100_000_000.0 - 0.01; // leave room for scale
|
const MAX_ABS: f64 = 100_000_000.0 - 0.01; // leave room for scale
|
||||||
|
|
||||||
let allowed = MAX_ABS - current_money;
|
let _allowed = MAX_ABS - current_money;
|
||||||
|
|
||||||
eprintln!(
|
|
||||||
"[BaseWorker] money clamp debug: current_money={}, money_change={}, tentative={}, allowed_max_delta={}",
|
|
||||||
current_money, money_change, tentative, allowed
|
|
||||||
);
|
|
||||||
|
|
||||||
let adjusted_money_change = if tentative >= MAX_ABS {
|
let adjusted_money_change = if tentative >= MAX_ABS {
|
||||||
let clipped = MAX_ABS - current_money;
|
let clipped = MAX_ABS - current_money;
|
||||||
@@ -203,10 +198,7 @@ impl BaseWorker {
|
|||||||
money_change
|
money_change
|
||||||
};
|
};
|
||||||
|
|
||||||
eprintln!(
|
// Keep only important clamp logging: when clipping occurs we log it above.
|
||||||
"[BaseWorker] money clamp debug result: adjusted_money_change={}",
|
|
||||||
adjusted_money_change
|
|
||||||
);
|
|
||||||
|
|
||||||
// Send exact types matching the DB function signature:
|
// Send exact types matching the DB function signature:
|
||||||
let uid_i32: i32 = falukant_user_id;
|
let uid_i32: i32 = falukant_user_id;
|
||||||
@@ -215,10 +207,7 @@ impl BaseWorker {
|
|||||||
// Note: we intentionally avoid parameterized call due to serialization
|
// Note: we intentionally avoid parameterized call due to serialization
|
||||||
// issues in this environment and instead execute a literal SQL below.
|
// issues in this environment and instead execute a literal SQL below.
|
||||||
|
|
||||||
eprintln!(
|
// Execute update; avoid noisy logging here.
|
||||||
"[BaseWorker] change_falukant_user_money: executing literal update_money(user_id={}, money_change='{}', action={})",
|
|
||||||
uid_i32, money_str, action
|
|
||||||
);
|
|
||||||
|
|
||||||
// Use a literal SQL call because parameterized execution keeps failing
|
// Use a literal SQL call because parameterized execution keeps failing
|
||||||
// with "error serializing parameter 1" in this environment.
|
// with "error serializing parameter 1" in this environment.
|
||||||
|
|||||||
Reference in New Issue
Block a user