mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-31 13:17:09 +00:00
Increase priority for validator HTTP requests (#6292)
* Increase priority for validator HTTP requests
This commit is contained in:
@@ -714,7 +714,14 @@ pub fn serve<T: BeaconChainTypes>(
|
|||||||
task_spawner: TaskSpawner<T::EthSpec>,
|
task_spawner: TaskSpawner<T::EthSpec>,
|
||||||
chain: Arc<BeaconChain<T>>,
|
chain: Arc<BeaconChain<T>>,
|
||||||
query_res: Result<api_types::ValidatorsQuery, warp::Rejection>| {
|
query_res: Result<api_types::ValidatorsQuery, warp::Rejection>| {
|
||||||
task_spawner.blocking_json_task(Priority::P1, move || {
|
// Prioritise requests for validators at the head. These should be fast to service
|
||||||
|
// and could be required by the validator client.
|
||||||
|
let priority = if let StateId(eth2::types::StateId::Head) = state_id {
|
||||||
|
Priority::P0
|
||||||
|
} else {
|
||||||
|
Priority::P1
|
||||||
|
};
|
||||||
|
task_spawner.blocking_json_task(priority, move || {
|
||||||
let query = query_res?;
|
let query = query_res?;
|
||||||
crate::validators::get_beacon_state_validators(
|
crate::validators::get_beacon_state_validators(
|
||||||
state_id,
|
state_id,
|
||||||
@@ -737,7 +744,14 @@ pub fn serve<T: BeaconChainTypes>(
|
|||||||
task_spawner: TaskSpawner<T::EthSpec>,
|
task_spawner: TaskSpawner<T::EthSpec>,
|
||||||
chain: Arc<BeaconChain<T>>,
|
chain: Arc<BeaconChain<T>>,
|
||||||
query: ValidatorsRequestBody| {
|
query: ValidatorsRequestBody| {
|
||||||
task_spawner.blocking_json_task(Priority::P1, move || {
|
// Prioritise requests for validators at the head. These should be fast to service
|
||||||
|
// and could be required by the validator client.
|
||||||
|
let priority = if let StateId(eth2::types::StateId::Head) = state_id {
|
||||||
|
Priority::P0
|
||||||
|
} else {
|
||||||
|
Priority::P1
|
||||||
|
};
|
||||||
|
task_spawner.blocking_json_task(priority, move || {
|
||||||
crate::validators::get_beacon_state_validators(
|
crate::validators::get_beacon_state_validators(
|
||||||
state_id,
|
state_id,
|
||||||
chain,
|
chain,
|
||||||
@@ -763,7 +777,14 @@ pub fn serve<T: BeaconChainTypes>(
|
|||||||
task_spawner: TaskSpawner<T::EthSpec>,
|
task_spawner: TaskSpawner<T::EthSpec>,
|
||||||
chain: Arc<BeaconChain<T>>,
|
chain: Arc<BeaconChain<T>>,
|
||||||
validator_id: ValidatorId| {
|
validator_id: ValidatorId| {
|
||||||
task_spawner.blocking_json_task(Priority::P1, move || {
|
// Prioritise requests for validators at the head. These should be fast to service
|
||||||
|
// and could be required by the validator client.
|
||||||
|
let priority = if let StateId(eth2::types::StateId::Head) = state_id {
|
||||||
|
Priority::P0
|
||||||
|
} else {
|
||||||
|
Priority::P1
|
||||||
|
};
|
||||||
|
task_spawner.blocking_json_task(priority, move || {
|
||||||
let (data, execution_optimistic, finalized) = state_id
|
let (data, execution_optimistic, finalized) = state_id
|
||||||
.map_state_and_execution_optimistic_and_finalized(
|
.map_state_and_execution_optimistic_and_finalized(
|
||||||
&chain,
|
&chain,
|
||||||
|
|||||||
Reference in New Issue
Block a user