File tree Expand file tree Collapse file tree 4 files changed +8
-13
lines changed Expand file tree Collapse file tree 4 files changed +8
-13
lines changed Original file line number Diff line number Diff line change 612612 ( = :version ) )
613613 ( xapi-stdext-pervasives
614614 ( = :version ) )
615+ ( xapi-stdext-std
616+ ( = :version ) )
615617 ( xapi-stdext-threads
616618 ( = :version ) )
617619 ( xapi-stdext-unix
Original file line number Diff line number Diff line change 1313 xapi-inventory
1414 xapi-log
1515 xapi-stdext-pervasives
16+ xapi-stdext-std
1617 xapi-stdext-threads
1718 xapi-stdext-unix
1819 )
Original file line number Diff line number Diff line change @@ -27,6 +27,8 @@ open Safe_resources
2727
2828let with_lock = Xapi_stdext_threads.Threadext.Mutex. execute
2929
30+ let list_drop = Xapi_stdext_std.Listext.List. drop
31+
3032(* Disable debug-level logging but leave higher-priority enabled. It would be
3133 * better to handle this sort of configuration in the Debug module itself.
3234 *)
@@ -93,17 +95,6 @@ let unlocked_gc () =
9395 ! index " "
9496 )
9597 ) ;
96- (* Split a list at the given index to give a pair of lists.
97- * From Xapi_stdext_std.Listext *)
98- let rec chop i l =
99- match (i, l) with
100- | 0 , l ->
101- ([] , l)
102- | i , h :: t ->
103- (fun (fr , ba ) -> (h :: fr, ba)) (chop (i - 1 ) t)
104- | _ ->
105- invalid_arg " chop"
106- in
10798 let all_ids = Tbl. fold ! stunnels (fun k _ acc -> k :: acc) [] in
10899 let to_gc = ref [] in
109100 (* Find the ones which are too old *)
@@ -134,8 +125,8 @@ let unlocked_gc () =
134125 List. filter (fun (idx , _ ) -> not (List. mem idx ! to_gc)) times'
135126 in
136127 (* Sort into descending order of donation time, ie youngest first *)
137- let times' = List. sort (fun x y -> compare (fst y) (fst x) ) times' in
138- let _youngest, oldest = chop max_stunnel times' in
128+ let times' = List. sort (fun ( x , _ ) ( y , _ ) -> compare y x ) times' in
129+ let oldest = list_drop max_stunnel times' in
139130 let oldest_ids = List. map fst oldest in
140131 List. iter
141132 (fun x ->
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ depends: [
1818 "xapi-inventory"
1919 "xapi-log" {= version}
2020 "xapi-stdext-pervasives" {= version}
21+ "xapi-stdext-std" {= version}
2122 "xapi-stdext-threads" {= version}
2223 "xapi-stdext-unix" {= version}
2324 "odoc" {with-doc}
You can’t perform that action at this time.
0 commit comments