mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-05 18:25:57 +00:00
collab: Count active users based on the tokens per minute measure (#16911)
This PR fixes an issue where active user counts were being computed across _all_ measures instead of the per-minute measures. We now compute them using the tokens per minute measure, as we're concerned with usage in recent minutes. Release Notes: - N/A
This commit is contained in:
parent
3ddec4816a
commit
93a7682659
1 changed files with 4 additions and 0 deletions
|
@ -359,10 +359,13 @@ impl LlmDatabase {
|
|||
.get(&(provider, model_name.to_string()))
|
||||
.ok_or_else(|| anyhow!("unknown model {provider}:{model_name}"))?;
|
||||
|
||||
let tokens_per_minute = self.usage_measure_ids[&UsageMeasure::TokensPerMinute];
|
||||
|
||||
let users_in_recent_minutes = usage::Entity::find()
|
||||
.filter(
|
||||
usage::Column::ModelId
|
||||
.eq(model.id)
|
||||
.and(usage::Column::MeasureId.eq(tokens_per_minute))
|
||||
.and(usage::Column::Timestamp.gte(minute_since.naive_utc()))
|
||||
.and(usage::Column::IsStaff.eq(false)),
|
||||
)
|
||||
|
@ -376,6 +379,7 @@ impl LlmDatabase {
|
|||
.filter(
|
||||
usage::Column::ModelId
|
||||
.eq(model.id)
|
||||
.and(usage::Column::MeasureId.eq(tokens_per_minute))
|
||||
.and(usage::Column::Timestamp.gte(day_since.naive_utc()))
|
||||
.and(usage::Column::IsStaff.eq(false)),
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue