File tree Expand file tree Collapse file tree 1 file changed +6
-12
lines changed Expand file tree Collapse file tree 1 file changed +6
-12
lines changed Original file line number Diff line number Diff line change @@ -144,12 +144,9 @@ impl ExplorerHttpClient {
144
144
145
145
/// Gets beacon metrics and updates the metrics struct
146
146
pub async fn get_beacon_metrics ( & self ) -> Result < ExplorerMetrics , Error > {
147
- let path = self
148
- . beacon_endpoint
149
- . clone ( )
150
- . ok_or ( Error :: BeaconMetricsFailed (
151
- "Beacon metrics endpoint not provided" . to_string ( ) ,
152
- ) ) ?;
147
+ let path = self . beacon_endpoint . clone ( ) . ok_or_else ( || {
148
+ Error :: BeaconMetricsFailed ( "Beacon metrics endpoint not provided" . to_string ( ) )
149
+ } ) ?;
153
150
let resp: BeaconProcessMetrics = self . get ( path) . await ?;
154
151
Ok ( ExplorerMetrics {
155
152
metadata : Metadata :: new ( ProcessType :: Beacon ) ,
@@ -159,12 +156,9 @@ impl ExplorerHttpClient {
159
156
160
157
/// Gets validator process metrics by querying the validator metrics endpoint
161
158
pub async fn get_validator_metrics ( & self ) -> Result < ExplorerMetrics , Error > {
162
- let path = self
163
- . validator_endpoint
164
- . clone ( )
165
- . ok_or ( Error :: ValidatorMetricsFailed (
166
- "Validator metrics endpoint not provided" . to_string ( ) ,
167
- ) ) ?;
159
+ let path = self . validator_endpoint . clone ( ) . ok_or_else ( || {
160
+ Error :: ValidatorMetricsFailed ( "Validator metrics endpoint not provided" . to_string ( ) )
161
+ } ) ?;
168
162
let resp: ValidatorProcessMetrics = self . get ( path) . await ?;
169
163
Ok ( ExplorerMetrics {
170
164
metadata : Metadata :: new ( ProcessType :: Beacon ) ,
You can’t perform that action at this time.
0 commit comments