@@ -11,18 +11,14 @@ import { getStatus } from "../../status";
11
11
import { PublisherIcon } from "../PublisherIcon" ;
12
12
import { PublisherTag } from "../PublisherTag" ;
13
13
import { PublishersCard } from "./publishers-card" ;
14
+ import { funcA , funcAUnstableCache } from "./util" ;
14
15
15
16
type Props = {
16
17
params : Promise < {
17
18
slug : string ;
18
19
} > ;
19
20
} ;
20
21
21
- const funcA = async ( ) => {
22
- "use cache" ;
23
- await new Promise ( ( resolve ) => setTimeout ( resolve , 2000 ) ) ;
24
- return Math . random ( ) ;
25
- }
26
22
27
23
const funcB = async ( ) => {
28
24
const start = performance . now ( ) ;
@@ -33,6 +29,14 @@ const funcB = async () => {
33
29
return res ;
34
30
}
35
31
32
+ const funcBUnstableCache = async ( ) => {
33
+ const start = performance . now ( ) ;
34
+ const res = await funcAUnstableCache ( ) ;
35
+ const end = performance . now ( ) ;
36
+ // eslint-disable-next-line no-console, @typescript-eslint/restrict-template-expressions
37
+ console . log ( `funcBUnstableCache: ${ end - start } ms` ) ;
38
+ return res ;
39
+ }
36
40
37
41
export const Publishers = async ( { params } : Props ) => {
38
42
const { slug } = await params ;
@@ -42,13 +46,19 @@ export const Publishers = async ({ params }: Props) => {
42
46
pythtestConformanceFeeds ,
43
47
pythnetPublishers ,
44
48
pythtestConformancePublishers ,
49
+ funcRes ,
50
+ funcResUnstableCache ,
45
51
] = await Promise . all ( [
46
52
getFeedsCached ( Cluster . Pythnet ) ,
47
53
getFeedsCached ( Cluster . PythtestConformance ) ,
48
54
getPublishers ( Cluster . Pythnet , symbol ) ,
49
55
getPublishers ( Cluster . PythtestConformance , symbol ) ,
50
56
funcB ( ) ,
57
+ funcBUnstableCache ( ) ,
51
58
] ) ;
59
+
60
+ // eslint-disable-next-line no-console, @typescript-eslint/restrict-template-expressions
61
+ console . log ( funcRes , funcResUnstableCache ) ;
52
62
const feed = pythnetFeeds . find ( ( feed ) => feed . symbol === symbol ) ;
53
63
const testFeed = pythtestConformanceFeeds . find (
54
64
( feed ) => feed . symbol === symbol ,
0 commit comments