@@ -12,7 +12,6 @@ const cache = new Map<string, CacheData>();
12
12
interface CacheData {
13
13
data : CopilotMetrics [ ] ;
14
14
valid_until : number ;
15
- auth_fingerprint : string ; // hashed representation of Authorization header used to populate cache
16
15
}
17
16
18
17
class MetricsError extends Error {
@@ -112,7 +111,7 @@ export async function getMetricsData(event: H3Event<EventHandlerRequest>): Promi
112
111
// Attempt cache lookup with auth fingerprint validation
113
112
const cachedData = cache . get ( cacheKey ) ;
114
113
if ( cachedData ) {
115
- if ( cachedData . valid_until > Date . now ( ) / 1000 && cachedData . auth_fingerprint === cacheKey . split ( ':' ) [ 0 ] ) {
114
+ if ( cachedData . valid_until > Date . now ( ) / 1000 ) {
116
115
logger . info ( `Returning cached data for ${ cacheKey } ` ) ;
117
116
return cachedData . data ;
118
117
} else {
@@ -134,8 +133,7 @@ export async function getMetricsData(event: H3Event<EventHandlerRequest>): Promi
134
133
const filteredUsageData = filterHolidaysFromMetrics ( usageData , options . excludeHolidays || false , options . locale ) ;
135
134
// metrics is the old API format
136
135
const validUntil = Math . floor ( Date . now ( ) / 1000 ) + 5 * 60 ; // Cache for 5 minutes
137
- const authFingerprint : string = cacheKey . split ( ':' , 1 ) [ 0 ] || '' ;
138
- cache . set ( cacheKey , { data : filteredUsageData , valid_until : validUntil , auth_fingerprint : authFingerprint } ) ;
136
+ cache . set ( cacheKey , { data : filteredUsageData , valid_until : validUntil } ) ;
139
137
return filteredUsageData ;
140
138
} catch ( error : unknown ) {
141
139
logger . error ( 'Error fetching metrics data:' , error ) ;
0 commit comments