File tree Expand file tree Collapse file tree 4 files changed +28
-1
lines changed
mithril-aggregator/src/dependency_injection/builder Expand file tree Collapse file tree 4 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -81,9 +81,11 @@ impl DependenciesBuilder {
81
81
82
82
/// Builds a [SignatureProcessor]
83
83
pub async fn create_signature_processor ( & mut self ) -> Result < Arc < dyn SignatureProcessor > > {
84
+ let ( _stop_tx, stop_rx) = self . get_stop_signal_channel ( ) . await ?;
84
85
let signature_processor = SequentialSignatureProcessor :: new (
85
86
self . build_signature_consumer ( ) . await ?,
86
87
self . get_certifier_service ( ) . await ?,
88
+ stop_rx,
87
89
self . root_logger ( ) ,
88
90
) ;
89
91
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ use std::{path::PathBuf, sync::Arc};
8
8
use tokio:: {
9
9
sync:: {
10
10
mpsc:: { UnboundedReceiver , UnboundedSender } ,
11
- Mutex ,
11
+ watch , Mutex ,
12
12
} ,
13
13
time:: Duration ,
14
14
} ;
@@ -273,6 +273,9 @@ pub struct DependenciesBuilder {
273
273
274
274
/// Protocol parameters retriever
275
275
pub protocol_parameters_retriever : Option < Arc < dyn ProtocolParametersRetriever > > ,
276
+
277
+ /// Stop signal channel
278
+ pub stop_signal_channel : Option < ( watch:: Sender < ( ) > , watch:: Receiver < ( ) > ) > ,
276
279
}
277
280
278
281
impl DependenciesBuilder {
@@ -335,6 +338,7 @@ impl DependenciesBuilder {
335
338
metrics_service : None ,
336
339
leader_aggregator_client : None ,
337
340
protocol_parameters_retriever : None ,
341
+ stop_signal_channel : None ,
338
342
}
339
343
}
340
344
Original file line number Diff line number Diff line change 4
4
5
5
mod compatibility;
6
6
mod observability;
7
+ mod signal;
7
8
mod sqlite;
8
9
mod stores;
9
10
mod upkeep;
Original file line number Diff line number Diff line change
1
+ use tokio:: sync:: watch;
2
+
3
+ use crate :: dependency_injection:: { DependenciesBuilder , Result } ;
4
+ use crate :: get_dependency;
5
+
6
+ impl DependenciesBuilder {
7
+ /// Builds a stop signal channel
8
+ pub async fn build_stop_signal_channel (
9
+ & mut self ,
10
+ ) -> Result < ( watch:: Sender < ( ) > , watch:: Receiver < ( ) > ) > {
11
+ Ok ( watch:: channel ( ( ) ) )
12
+ }
13
+
14
+ /// Get the stop signal channel
15
+ pub async fn get_stop_signal_channel (
16
+ & mut self ,
17
+ ) -> Result < ( watch:: Sender < ( ) > , watch:: Receiver < ( ) > ) > {
18
+ get_dependency ! ( self . stop_signal_channel)
19
+ }
20
+ }
You can’t perform that action at this time.
0 commit comments