Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
polkadot-sdk
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
parity
Mirrored projects
polkadot-sdk
Commits
489a8e6d
Commit
489a8e6d
authored
3 years ago
by
Robert Klotzner
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fill up requests slots via `launch_parallel_requests` (#3681)
in case waiting for the next response takes too long.
parent
04e937d7
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
polkadot/node/network/availability-recovery/src/lib.rs
+11
-2
11 additions, 2 deletions
polkadot/node/network/availability-recovery/src/lib.rs
with
11 additions
and
2 deletions
polkadot/node/network/availability-recovery/src/lib.rs
+
11
−
2
View file @
489a8e6d
...
...
@@ -21,6 +21,7 @@
use
std
::{
collections
::{
HashMap
,
VecDeque
},
pin
::
Pin
,
time
::
Duration
,
};
use
futures
::{
...
...
@@ -43,7 +44,7 @@ use polkadot_node_network_protocol::{
IfDisconnected
,
UnifiedReputationChange
as
Rep
,
};
use
polkadot_node_primitives
::{
AvailableData
,
ErasureChunk
};
use
polkadot_node_subsystem_util
::
request_session_info
;
use
polkadot_node_subsystem_util
::
{
request_session_info
,
TimeoutExt
}
;
use
polkadot_primitives
::
v1
::{
AuthorityDiscoveryId
,
BlakeTwo256
,
BlockNumber
,
CandidateHash
,
CandidateReceipt
,
GroupIndex
,
Hash
,
HashT
,
SessionIndex
,
SessionInfo
,
ValidatorId
,
ValidatorIndex
,
...
...
@@ -72,6 +73,10 @@ const LRU_SIZE: usize = 16;
const
COST_INVALID_REQUEST
:
Rep
=
Rep
::
CostMajor
(
"Peer sent unparsable request"
);
/// Max time we want to wait for responses, before calling `launch_parallel_requests` again to fill
/// up slots.
const
MAX_CHUNK_WAIT
:
Duration
=
Duration
::
from_secs
(
1
);
/// The Availability Recovery Subsystem.
pub
struct
AvailabilityRecoverySubsystem
{
fast_path
:
bool
,
...
...
@@ -285,7 +290,11 @@ impl RequestChunksPhase {
async
fn
wait_for_chunks
(
&
mut
self
,
params
:
&
InteractionParams
)
{
// Wait for all current requests to conclude or time-out, or until we reach enough chunks.
while
let
Some
(
request_result
)
=
self
.requesting_chunks
.next
()
.await
{
// We will also stop, if there has not been a response for `MAX_CHUNK_WAIT`, so
// `launch_parallel_requests` cann fill up slots again.
while
let
Some
(
request_result
)
=
self
.requesting_chunks
.next
()
.timeout
(
MAX_CHUNK_WAIT
)
.await
.flatten
()
{
match
request_result
{
Ok
(
Some
(
chunk
))
=>
{
// Check merkle proofs of any received chunks.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment