File tree Expand file tree Collapse file tree 4 files changed +8
-7
lines changed
Expand file tree Collapse file tree 4 files changed +8
-7
lines changed Original file line number Diff line number Diff line change 11use std:: {
22 str:: FromStr ,
3+ sync:: Arc ,
34 time:: { Instant , SystemTime , UNIX_EPOCH } ,
45} ;
56
@@ -34,7 +35,7 @@ pub struct GatewayServer {
3435 db : Db ,
3536 config : Config ,
3637 network : Network ,
37- metrics : GatewayMetrics ,
38+ metrics : Arc < GatewayMetrics > ,
3839}
3940
4041impl GatewayServer {
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ pub struct GatewayMetrics {
99}
1010
1111impl GatewayMetrics {
12- pub fn start ( metrics_port : u16 ) -> Result < Self , prometheus:: Error > {
12+ pub fn start ( metrics_port : u16 ) -> Result < Arc < Self > , prometheus:: Error > {
1313 let registry = Registry :: new ( ) ;
1414
1515 let time_elapsed_db_post = Histogram :: with_opts ( histogram_opts ! (
@@ -40,7 +40,7 @@ impl GatewayMetrics {
4040 . await ;
4141 } ) ;
4242
43- Ok ( Arc :: try_unwrap ( metrics) . unwrap_or_else ( |arc| ( * arc ) . clone ( ) ) )
43+ Ok ( metrics)
4444 }
4545
4646 async fn metrics_handler ( metrics : web:: Data < Arc < GatewayMetrics > > ) -> impl Responder {
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ pub struct PaymentsPollerMetrics {
99}
1010
1111impl PaymentsPollerMetrics {
12- pub fn start ( metrics_port : u16 ) -> Result < Self , prometheus:: Error > {
12+ pub fn start ( metrics_port : u16 ) -> Result < Arc < Self > , prometheus:: Error > {
1313 let registry = Registry :: new ( ) ;
1414
1515 let last_processed_block = Gauge :: with_opts ( opts ! (
@@ -43,7 +43,7 @@ impl PaymentsPollerMetrics {
4343 . await ;
4444 } ) ;
4545
46- Ok ( Arc :: try_unwrap ( metrics) . unwrap_or_else ( |arc| ( * arc ) . clone ( ) ) )
46+ Ok ( metrics)
4747 }
4848
4949 async fn metrics_handler ( metrics : web:: Data < Arc < PaymentsPollerMetrics > > ) -> impl Responder {
Original file line number Diff line number Diff line change 1- use std:: str:: FromStr ;
1+ use std:: { str:: FromStr , sync :: Arc } ;
22
33use crate :: {
44 config:: Config ,
@@ -22,7 +22,7 @@ pub struct PaymentsPoller {
2222 proof_aggregation_service : AggregationModePaymentServiceContract ,
2323 rpc_provider : RpcProvider ,
2424 config : Config ,
25- metrics : PaymentsPollerMetrics ,
25+ metrics : Arc < PaymentsPollerMetrics > ,
2626}
2727
2828impl PaymentsPoller {
You can’t perform that action at this time.
0 commit comments