@@ -714,7 +714,14 @@ pub fn serve<T: BeaconChainTypes>(
714
714
task_spawner : TaskSpawner < T :: EthSpec > ,
715
715
chain : Arc < BeaconChain < T > > ,
716
716
query_res : Result < api_types:: ValidatorsQuery , warp:: Rejection > | {
717
- task_spawner. blocking_json_task ( Priority :: P1 , move || {
717
+ // Prioritise requests for validators at the head. These should be fast to service
718
+ // and could be required by the validator client.
719
+ let priority = if let StateId ( eth2:: types:: StateId :: Head ) = state_id {
720
+ Priority :: P0
721
+ } else {
722
+ Priority :: P1
723
+ } ;
724
+ task_spawner. blocking_json_task ( priority, move || {
718
725
let query = query_res?;
719
726
crate :: validators:: get_beacon_state_validators (
720
727
state_id,
@@ -737,7 +744,14 @@ pub fn serve<T: BeaconChainTypes>(
737
744
task_spawner : TaskSpawner < T :: EthSpec > ,
738
745
chain : Arc < BeaconChain < T > > ,
739
746
query : ValidatorsRequestBody | {
740
- task_spawner. blocking_json_task ( Priority :: P1 , move || {
747
+ // Prioritise requests for validators at the head. These should be fast to service
748
+ // and could be required by the validator client.
749
+ let priority = if let StateId ( eth2:: types:: StateId :: Head ) = state_id {
750
+ Priority :: P0
751
+ } else {
752
+ Priority :: P1
753
+ } ;
754
+ task_spawner. blocking_json_task ( priority, move || {
741
755
crate :: validators:: get_beacon_state_validators (
742
756
state_id,
743
757
chain,
@@ -763,7 +777,14 @@ pub fn serve<T: BeaconChainTypes>(
763
777
task_spawner : TaskSpawner < T :: EthSpec > ,
764
778
chain : Arc < BeaconChain < T > > ,
765
779
validator_id : ValidatorId | {
766
- task_spawner. blocking_json_task ( Priority :: P1 , move || {
780
+ // Prioritise requests for validators at the head. These should be fast to service
781
+ // and could be required by the validator client.
782
+ let priority = if let StateId ( eth2:: types:: StateId :: Head ) = state_id {
783
+ Priority :: P0
784
+ } else {
785
+ Priority :: P1
786
+ } ;
787
+ task_spawner. blocking_json_task ( priority, move || {
767
788
let ( data, execution_optimistic, finalized) = state_id
768
789
. map_state_and_execution_optimistic_and_finalized (
769
790
& chain,
0 commit comments