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 = {
18
18
} > ;
19
19
} ;
20
20
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
+
21
37
export const Publishers = async ( { params } : Props ) => {
22
38
const { slug } = await params ;
23
39
const symbol = decodeURIComponent ( slug ) ;
@@ -31,6 +47,7 @@ export const Publishers = async ({ params }: Props) => {
31
47
getFeedsCached ( Cluster . PythtestConformance ) ,
32
48
getPublishers ( Cluster . Pythnet , symbol ) ,
33
49
getPublishers ( Cluster . PythtestConformance , symbol ) ,
50
+ funcB ( ) ,
34
51
] ) ;
35
52
const feed = pythnetFeeds . find ( ( feed ) => feed . symbol === symbol ) ;
36
53
const testFeed = pythtestConformanceFeeds . find (
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ export const Publishers = async () => {
29
29
await Promise . all ( [
30
30
getPublishersCached ( Cluster . Pythnet ) ,
31
31
getPublishersCached ( Cluster . PythtestConformance ) ,
32
- getOisStats ( ) ,
32
+ getOisStatsCached ( ) ,
33
33
] ) ;
34
34
35
35
const rankingTime = pythnetPublishers [ 0 ] ?. timestamp ;
@@ -165,15 +165,15 @@ const toTableRow = ({
165
165
} ;
166
166
} ;
167
167
168
- const getOisStats = async ( ) => {
168
+ const getOisStatsCached = async ( ) => {
169
+ "use cache" ;
169
170
const [ delState , claimableRewards , distributedRewards , publisherCaps ] =
170
171
await Promise . all ( [
171
172
getDelState ( ) ,
172
173
getClaimableRewards ( ) ,
173
174
getDistributedRewards ( ) ,
174
175
getPublisherCaps ( ) ,
175
176
] ) ;
176
-
177
177
return {
178
178
totalStaked :
179
179
sumDelegations ( delState . delState ) + sumDelegations ( delState . selfDelState ) ,
You can’t perform that action at this time.
0 commit comments