dont put anon stats in the db (for now)
the indexes need to be fixed. UNIQUE+NULL do not play nice
This commit is contained in:
parent
264508c454
commit
140dc04a8b
@ -94,6 +94,12 @@ pub struct RpcQueryKey {
|
|||||||
rpc_key_user_id: Option<NonZeroU64>,
|
rpc_key_user_id: Option<NonZeroU64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl RpcQueryKey {
|
||||||
|
pub fn is_registered(&self) -> bool {
|
||||||
|
self.rpc_key_user_id.is_some()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// round the unix epoch time to the start of a period
|
/// round the unix epoch time to the start of a period
|
||||||
fn round_timestamp(timestamp: i64, period_seconds: i64) -> i64 {
|
fn round_timestamp(timestamp: i64, period_seconds: i64) -> i64 {
|
||||||
timestamp / period_seconds * period_seconds
|
timestamp / period_seconds * period_seconds
|
||||||
|
@ -178,7 +178,10 @@ impl StatBuffer {
|
|||||||
approximate_balance_remaining = user_balance.remaining();
|
approximate_balance_remaining = user_balance.remaining();
|
||||||
}
|
}
|
||||||
|
|
||||||
self.accounting_db_buffer.entry(stat.accounting_key(self.billing_period_seconds)).or_default().add(stat.clone(), approximate_balance_remaining).await;
|
let accounting_key = stat.accounting_key(self.billing_period_seconds);
|
||||||
|
if accounting_key.is_registered() {
|
||||||
|
self.accounting_db_buffer.entry(accounting_key).or_default().add(stat.clone(), approximate_balance_remaining).await;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.influxdb_client.is_some() {
|
if self.influxdb_client.is_some() {
|
||||||
|
Loading…
Reference in New Issue
Block a user