@@ -15,8 +15,24 @@ use crate::selector::{self, PathComponent, Tag};
15
15
pub async fn handle_graph (
16
16
body : graph:: Request ,
17
17
ctxt : & SiteCtxt ,
18
- ) -> ServerResult < graph:: NewResponse > {
18
+ ) -> ServerResult < Arc < graph:: NewResponse > > {
19
19
log:: info!( "handle_graph({:?})" , body) ;
20
+
21
+ let is_default_query = body
22
+ == graph:: Request {
23
+ start : Bound :: None ,
24
+ end : Bound :: None ,
25
+ stat : String :: from ( "instructions:u" ) ,
26
+ kind : graph:: GraphKind :: Raw ,
27
+ } ;
28
+
29
+ if is_default_query {
30
+ match & * * ctxt. landing_page . load ( ) {
31
+ Some ( resp) => return Ok ( resp. clone ( ) ) ,
32
+ None => { }
33
+ }
34
+ }
35
+
20
36
let range = ctxt. data_range ( body. start . clone ( ) ..=body. end . clone ( ) ) ;
21
37
let commits: Vec < ArtifactId > = range. iter ( ) . map ( |c| c. clone ( ) . into ( ) ) . collect ( ) ;
22
38
@@ -52,7 +68,7 @@ pub async fn handle_graph(
52
68
benchmarks. insert ( benchmark_. clone ( ) , by_profile) ;
53
69
}
54
70
55
- Ok ( graph:: NewResponse {
71
+ let resp = Arc :: new ( graph:: NewResponse {
56
72
commits : commits
57
73
. into_iter ( )
58
74
. map ( |c| match c {
@@ -61,30 +77,21 @@ pub async fn handle_graph(
61
77
} )
62
78
. collect ( ) ,
63
79
benchmarks,
64
- } )
80
+ } ) ;
81
+
82
+ if is_default_query {
83
+ ctxt. landing_page . store ( Arc :: new ( Some ( resp. clone ( ) ) ) ) ;
84
+ }
85
+
86
+ Ok ( resp)
65
87
}
66
88
67
89
static INTERPOLATED_COLOR : & str = "#fcb0f1" ;
68
90
69
91
async fn handle_graph_impl (
70
92
body : graph:: Request ,
71
93
ctxt : & SiteCtxt ,
72
- ) -> ServerResult < Arc < graph:: Response > > {
73
- let is_default_query = body
74
- == graph:: Request {
75
- start : Bound :: None ,
76
- end : Bound :: None ,
77
- stat : String :: from ( "instructions:u" ) ,
78
- kind : graph:: GraphKind :: Raw ,
79
- } ;
80
-
81
- if is_default_query {
82
- match & * * ctxt. landing_page . load ( ) {
83
- Some ( resp) => return Ok ( resp. clone ( ) ) ,
84
- None => { }
85
- }
86
- }
87
-
94
+ ) -> ServerResult < graph:: Response > {
88
95
let cc = CommitIdxCache :: new ( ) ;
89
96
let range = ctxt. data_range ( body. start . clone ( ) ..=body. end . clone ( ) ) ;
90
97
let commits: Arc < Vec < _ > > = Arc :: new ( range. iter ( ) . map ( |c| c. clone ( ) . into ( ) ) . collect ( ) ) ;
@@ -215,18 +222,12 @@ async fn handle_graph_impl(
215
222
. push ( ( sr. path . get :: < Scenario > ( ) ?. to_string ( ) , sr. series ) ) ;
216
223
}
217
224
218
- let resp = Arc :: new ( graph:: Response {
225
+ Ok ( graph:: Response {
219
226
max : by_benchmark_max,
220
227
benchmarks : by_test_case,
221
228
colors : vec ! [ String :: new( ) , String :: from( INTERPOLATED_COLOR ) ] ,
222
229
commits : cc. into_commits ( ) ,
223
- } ) ;
224
-
225
- if is_default_query {
226
- ctxt. landing_page . store ( Arc :: new ( Some ( resp. clone ( ) ) ) ) ;
227
- }
228
-
229
- Ok ( resp)
230
+ } )
230
231
}
231
232
232
233
struct CommitIdxCache {
0 commit comments