@@ -5,6 +5,7 @@ use std::time::Duration;
5
5
6
6
pub ( crate ) struct Limits {
7
7
memory : usize ,
8
+ targets : usize ,
8
9
timeout : Duration ,
9
10
networking : bool ,
10
11
max_log_size : usize ,
@@ -15,6 +16,7 @@ impl Default for Limits {
15
16
Self {
16
17
memory : 3 * 1024 * 1024 * 1024 , // 3 GB
17
18
timeout : Duration :: from_secs ( 15 * 60 ) , // 15 minutes
19
+ targets : 10 ,
18
20
networking : false ,
19
21
max_log_size : 100 * 1024 , // 100 KB
20
22
}
@@ -37,6 +39,9 @@ impl Limits {
37
39
if let Some ( timeout) = row. get :: < _ , Option < i32 > > ( "timeout_seconds" ) {
38
40
limits. timeout = Duration :: from_secs ( timeout as u64 ) ;
39
41
}
42
+ if let Some ( targets) = row. get :: < _ , Option < u32 > > ( "max_targets" ) {
43
+ limits. targets = targets as usize ;
44
+ }
40
45
}
41
46
42
47
Ok ( limits)
@@ -58,6 +63,10 @@ impl Limits {
58
63
self . max_log_size
59
64
}
60
65
66
+ pub ( crate ) fn targets ( & self ) -> usize {
67
+ self . targets
68
+ }
69
+
61
70
pub ( crate ) fn for_website ( & self ) -> BTreeMap < String , String > {
62
71
let time_scale = |v| scale ( v, 60 , & [ "seconds" , "minutes" , "hours" ] ) ;
63
72
let size_scale = |v| scale ( v, 1024 , & [ "bytes" , "KB" , "MB" , "GB" ] ) ;
@@ -74,6 +83,7 @@ impl Limits {
74
83
} else {
75
84
res. insert ( "Network access" . into ( ) , "blocked" . into ( ) ) ;
76
85
}
86
+ res. insert ( "Maximum number of build targets" . into ( ) , self . targets . to_string ( ) ) ;
77
87
res
78
88
}
79
89
}
0 commit comments