@@ -38,6 +38,7 @@ export async function getFeedsForPublisherCached(
3838}
3939
4040export const getFeedsCached = async ( cluster : Cluster ) => {
41+ const start = Date . now ( ) ;
4142 const data = await fetch ( `${ PUBLIC_URL } /api/pyth/get-feeds?cluster=${ cluster . toString ( ) } &excludePriceComponents=true` , {
4243 next : {
4344 revalidate : DEFAULT_CACHE_TTL ,
@@ -48,10 +49,14 @@ export const getFeedsCached = async (cluster: Cluster) => {
4849 } ) ;
4950 const dataJson = await data . text ( ) ;
5051 const feeds : Omit < z . infer < typeof priceFeedsSchema > [ 0 ] , "price" > [ ] = parse ( dataJson ) ;
52+ const end = Date . now ( ) ;
53+ // eslint-disable-next-line no-console
54+ console . log ( "getFeedsCached" , cluster , end - start ) ;
5155 return feeds ;
5256}
5357
5458export const getFeedForSymbolCached = async ( { symbol, cluster = Cluster . Pythnet } : { symbol : string , cluster ?: Cluster } ) : Promise < z . infer < typeof priceFeedsSchema > [ 0 ] | undefined > => {
59+ const start = Date . now ( ) ;
5560 const data = await fetch ( `${ PUBLIC_URL } /api/pyth/get-feeds/${ encodeURIComponent ( symbol ) } ?cluster=${ cluster . toString ( ) } ` , {
5661 next : {
5762 revalidate : DEFAULT_CACHE_TTL ,
@@ -60,12 +65,15 @@ export const getFeedForSymbolCached = async ({symbol, cluster = Cluster.Pythnet}
6065 'x-vercel-protection-bypass' : VERCEL_AUTOMATION_BYPASS_SECRET ,
6166 } ,
6267 } ) ;
63-
68+
6469 if ( ! data . ok ) {
6570 return undefined ;
6671 }
6772
6873 const dataJson = await data . text ( ) ;
6974 const feed : z . infer < typeof priceFeedsSchema > [ 0 ] = parse ( dataJson ) ;
75+ const end = Date . now ( ) ;
76+ // eslint-disable-next-line no-console
77+ console . log ( "getFeedForSymbolCached" , symbol , cluster , end - start ) ;
7078 return feed ;
7179}
0 commit comments