commit
0f4d12e2a5
@ -1192,6 +1192,7 @@ impl Web3ProxyApp {
|
|||||||
total_deposit: x.total_deposits,
|
total_deposit: x.total_deposits,
|
||||||
total_spend: x.total_spent_outside_free_tier,
|
total_spend: x.total_spent_outside_free_tier,
|
||||||
};
|
};
|
||||||
|
trace!("Balance for cache retrieved from database is {:?}", x);
|
||||||
|
|
||||||
return Ok(Arc::new(RwLock::new(x)));
|
return Ok(Arc::new(RwLock::new(x)));
|
||||||
}
|
}
|
||||||
|
@ -57,6 +57,7 @@ pub async fn query_user_stats<'a>(
|
|||||||
|
|
||||||
// In any case, we don't allow stats if the target user does not have a balance
|
// In any case, we don't allow stats if the target user does not have a balance
|
||||||
// No subuser, we can check the balance directly
|
// No subuser, we can check the balance directly
|
||||||
|
if user_id != 0 {
|
||||||
match balance::Entity::find()
|
match balance::Entity::find()
|
||||||
.filter(balance::Column::UserId.eq(user_id))
|
.filter(balance::Column::UserId.eq(user_id))
|
||||||
.one(db_replica.as_ref())
|
.one(db_replica.as_ref())
|
||||||
@ -109,6 +110,7 @@ pub async fn query_user_stats<'a>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: have a getter for this. do we need a connection pool on it?
|
// TODO: have a getter for this. do we need a connection pool on it?
|
||||||
let influxdb_client = app
|
let influxdb_client = app
|
||||||
|
@ -725,6 +725,8 @@ impl BufferedRpcQueryStats {
|
|||||||
// Read the latest balance ...
|
// Read the latest balance ...
|
||||||
let remaining = self.latest_balance.read().remaining();
|
let remaining = self.latest_balance.read().remaining();
|
||||||
|
|
||||||
|
trace!("Remaining balance for influx is {:?}", remaining);
|
||||||
|
|
||||||
builder = builder
|
builder = builder
|
||||||
.tag("archive_needed", key.archive_needed.to_string())
|
.tag("archive_needed", key.archive_needed.to_string())
|
||||||
.tag("error_response", key.error_response.to_string())
|
.tag("error_response", key.error_response.to_string())
|
||||||
@ -744,13 +746,17 @@ impl BufferedRpcQueryStats {
|
|||||||
)
|
)
|
||||||
.field(
|
.field(
|
||||||
"balance",
|
"balance",
|
||||||
remaining.to_f64().context("balance is really (too) large")?,
|
remaining
|
||||||
|
.to_f64()
|
||||||
|
.context("balance is really (too) large")?,
|
||||||
);
|
);
|
||||||
|
|
||||||
builder = builder.timestamp(key.response_timestamp);
|
builder = builder.timestamp(key.response_timestamp);
|
||||||
|
|
||||||
let point = builder.build()?;
|
let point = builder.build()?;
|
||||||
|
|
||||||
|
trace!("Datapoint saving to Influx is {:?}", point);
|
||||||
|
|
||||||
Ok(point)
|
Ok(point)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user