Skip to content

Commit bea58c9

Browse files
authored
Fix/key name (#926)
* fix: fix tier name key access * fix: apply change * fix: type cache entry
1 parent 7c5f971 commit bea58c9

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

app-server/src/traces/eligibility.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ use uuid::Uuid;
55

66
use crate::{
77
cache::{Cache, CacheTrait, keys::PROJECT_CACHE_KEY},
8-
db::{DB, project_settings::is_project_setting_enabled, projects::get_project_and_workspace_billing_info},
8+
db::{
9+
DB,
10+
project_settings::is_project_setting_enabled,
11+
projects::{ProjectWithWorkspaceBillingInfo, get_project_and_workspace_billing_info},
12+
},
913
};
1014

1115
#[derive(Debug, Clone)]
@@ -22,14 +26,12 @@ pub async fn check_trace_eligibility(
2226
project_id: Uuid,
2327
) -> Result<TraceEligibilityResult> {
2428
let cache_key = format!("{}:{}", PROJECT_CACHE_KEY, project_id);
25-
let project_info = cache.get::<serde_json::Value>(&cache_key).await;
29+
let project_info = cache
30+
.get::<ProjectWithWorkspaceBillingInfo>(&cache_key)
31+
.await;
2632

2733
let tier_name = match project_info {
28-
Ok(Some(info)) => {
29-
info.get("tier_name")
30-
.and_then(|v| v.as_str())
31-
.map(|s| s.to_string())
32-
}
34+
Ok(Some(info)) => Some(info.tier_name),
3335
_ => {
3436
// Fallback: query database if not in cache
3537
match get_project_and_workspace_billing_info(&db.pool, &project_id).await {

0 commit comments

Comments
 (0)