File tree Expand file tree Collapse file tree 2 files changed +20
-3
lines changed
apps/insights/src/components Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,22 @@ type Props = {
1818 } > ;
1919} ;
2020
21+ const funcA = async ( ) => {
22+ "use cache" ;
23+ await new Promise ( ( resolve ) => setTimeout ( resolve , 2000 ) ) ;
24+ return Math . random ( ) ;
25+ }
26+
27+ const funcB = async ( ) => {
28+ const start = performance . now ( ) ;
29+ const res = await funcA ( ) ;
30+ const end = performance . now ( ) ;
31+ // eslint-disable-next-line no-console, @typescript-eslint/restrict-template-expressions
32+ console . log ( `funcB: ${ end - start } ms` ) ;
33+ return res ;
34+ }
35+
36+
2137export const Publishers = async ( { params } : Props ) => {
2238 const { slug } = await params ;
2339 const symbol = decodeURIComponent ( slug ) ;
@@ -31,6 +47,7 @@ export const Publishers = async ({ params }: Props) => {
3147 getFeedsCached ( Cluster . PythtestConformance ) ,
3248 getPublishers ( Cluster . Pythnet , symbol ) ,
3349 getPublishers ( Cluster . PythtestConformance , symbol ) ,
50+ funcB ( ) ,
3451 ] ) ;
3552 const feed = pythnetFeeds . find ( ( feed ) => feed . symbol === symbol ) ;
3653 const testFeed = pythtestConformanceFeeds . find (
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ export const Publishers = async () => {
2929 await Promise . all ( [
3030 getPublishersCached ( Cluster . Pythnet ) ,
3131 getPublishersCached ( Cluster . PythtestConformance ) ,
32- getOisStats ( ) ,
32+ getOisStatsCached ( ) ,
3333 ] ) ;
3434
3535 const rankingTime = pythnetPublishers [ 0 ] ?. timestamp ;
@@ -165,15 +165,15 @@ const toTableRow = ({
165165 } ;
166166} ;
167167
168- const getOisStats = async ( ) => {
168+ const getOisStatsCached = async ( ) => {
169+ "use cache" ;
169170 const [ delState , claimableRewards , distributedRewards , publisherCaps ] =
170171 await Promise . all ( [
171172 getDelState ( ) ,
172173 getClaimableRewards ( ) ,
173174 getDistributedRewards ( ) ,
174175 getPublisherCaps ( ) ,
175176 ] ) ;
176-
177177 return {
178178 totalStaked :
179179 sumDelegations ( delState . delState ) + sumDelegations ( delState . selfDelState ) ,
You can’t perform that action at this time.
0 commit comments