Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mybee
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
mybee
Commits
991641b7
Unverified
Commit
991641b7
authored
Jul 29, 2021
by
acud
Committed by
GitHub
Jul 29, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor(pushsync): simplify error handling (#2378)
parent
2690dadd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
16 deletions
+1
-16
pushsync.go
pkg/pushsync/pushsync.go
+1
-16
No files found.
pkg/pushsync/pushsync.go
View file @
991641b7
...
@@ -28,7 +28,6 @@ import (
...
@@ -28,7 +28,6 @@ import (
"github.com/ethersphere/bee/pkg/tags"
"github.com/ethersphere/bee/pkg/tags"
"github.com/ethersphere/bee/pkg/topology"
"github.com/ethersphere/bee/pkg/topology"
"github.com/ethersphere/bee/pkg/tracing"
"github.com/ethersphere/bee/pkg/tracing"
"github.com/libp2p/go-libp2p-core/mux"
opentracing
"github.com/opentracing/opentracing-go"
opentracing
"github.com/opentracing/opentracing-go"
)
)
...
@@ -49,7 +48,7 @@ var (
...
@@ -49,7 +48,7 @@ var (
ErrWarmup
=
errors
.
New
(
"node warmup time not complete"
)
ErrWarmup
=
errors
.
New
(
"node warmup time not complete"
)
defaultTTL
=
20
*
time
.
Second
// request time to live
defaultTTL
=
20
*
time
.
Second
// request time to live
sanctionWait
=
time
.
Minute
sanctionWait
=
5
*
time
.
Minute
timeToWaitForPushsyncToNeighbor
=
3
*
time
.
Second
// time to wait to get a receipt for a chunk
timeToWaitForPushsyncToNeighbor
=
3
*
time
.
Second
// time to wait to get a receipt for a chunk
nPeersToPushsync
=
3
// number of peers to replicate to as receipt is sent upstream
nPeersToPushsync
=
3
// number of peers to replicate to as receipt is sent upstream
)
)
...
@@ -362,23 +361,9 @@ func (ps *PushSync) pushToClosest(ctx context.Context, ch swarm.Chunk, retryAllo
...
@@ -362,23 +361,9 @@ func (ps *PushSync) pushToClosest(ctx context.Context, ch swarm.Chunk, retryAllo
if
err
!=
nil
{
if
err
!=
nil
{
var
timeToSkip
time
.
Duration
var
timeToSkip
time
.
Duration
switch
{
switch
{
case
errors
.
Is
(
err
,
context
.
DeadlineExceeded
)
:
// can happen both in NN but also on forwarder nodes.
// if its inside the neighborhood - wait a long time.
// the originator retry will eventually come in and
// would hopefully resolve the situation with the next
// closest peer.
if
ps
.
topologyDriver
.
IsWithinDepth
(
ch
.
Address
())
{
timeToSkip
=
sanctionWait
}
case
errors
.
Is
(
err
,
accounting
.
ErrOverdraft
)
:
case
errors
.
Is
(
err
,
accounting
.
ErrOverdraft
)
:
skipPeers
=
append
(
skipPeers
,
peer
)
skipPeers
=
append
(
skipPeers
,
peer
)
case
errors
.
Is
(
err
,
mux
.
ErrReset
)
:
if
ps
.
topologyDriver
.
IsWithinDepth
(
ch
.
Address
())
{
timeToSkip
=
sanctionWait
}
default
:
default
:
// network error, context canceled, eof
timeToSkip
=
sanctionWait
timeToSkip
=
sanctionWait
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment