light client : failsafe crate (circuit breaker) (#9790)

* refactor(light) : N/W calls with `circuit breaker`

* fix(nits) : forgot to commit new files

* Add tests and change CLI args

* Address grumbles

* fix(failsafe-rs) : Santize input to prevent panics

* chore(failsafe) : bump failsafe, (parking_lot)

Bump failsafe to v0.3.0 to enable `parking_lot::Mutex` instead
`spin::Mutex`

* Remove `success_rate`

* feat(circuit_breaker logger)

* feat(CLI): separate CLI args request and response

* Fix tests

* Error response provide request kind

When a reponse `times-out` provide the actual request or requests that failed

* Update ethcore/light/src/on_demand/mod.rs

Co-Authored-By: niklasad1 <niklasadolfsson1@gmail.com>

* Update ethcore/light/src/on_demand/mod.rs

Co-Authored-By: niklasad1 <niklasadolfsson1@gmail.com>

* fix(grumbles): formatting nit

* fix(grumbles)

* Use second resolution on CLI args
* Use `consecutive failure policy` instead of `timeOverWindow`
* Add a couple of tests for `request_guard`

* fix(request_guard): off-by-one error, update tests
This commit is contained in:
Niklas Adolfsson
2018-12-05 10:36:53 +01:00
committed by Afri Schoedon
parent ec886ddefb
commit 7fb33796b1
13 changed files with 652 additions and 158 deletions

View File

@@ -397,8 +397,11 @@ impl Configuration {
whisper: whisper_config,
no_hardcoded_sync: self.args.flag_no_hardcoded_sync,
max_round_blocks_to_import: self.args.arg_max_round_blocks_to_import,
on_demand_retry_count: self.args.arg_on_demand_retry_count,
on_demand_inactive_time_limit: self.args.arg_on_demand_inactive_time_limit,
on_demand_response_time_window: self.args.arg_on_demand_response_time_window,
on_demand_request_backoff_start: self.args.arg_on_demand_request_backoff_start,
on_demand_request_backoff_max: self.args.arg_on_demand_request_backoff_max,
on_demand_request_backoff_rounds_max: self.args.arg_on_demand_request_backoff_rounds_max,
on_demand_request_consecutive_failures: self.args.arg_on_demand_request_consecutive_failures,
};
Cmd::Run(run_cmd)
};
@@ -1449,8 +1452,11 @@ mod tests {
no_persistent_txqueue: false,
whisper: Default::default(),
max_round_blocks_to_import: 12,
on_demand_retry_count: None,
on_demand_inactive_time_limit: None,
on_demand_response_time_window: None,
on_demand_request_backoff_start: None,
on_demand_request_backoff_max: None,
on_demand_request_backoff_rounds_max: None,
on_demand_request_consecutive_failures: None,
};
expected.secretstore_conf.enabled = cfg!(feature = "secretstore");
expected.secretstore_conf.http_enabled = cfg!(feature = "secretstore");