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
04075a19
Unverified
Commit
04075a19
authored
Sep 25, 2020
by
acud
Committed by
GitHub
Sep 25, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
increase amount of concurrent jobs (#748)
parent
aed7f865
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
12 deletions
+16
-12
pusher.go
pkg/pusher/pusher.go
+16
-12
No files found.
pkg/pusher/pusher.go
View file @
04075a19
...
...
@@ -31,7 +31,10 @@ type Service struct {
chunksWorkerQuitC
chan
struct
{}
}
var
retryInterval
=
5
*
time
.
Second
// time interval between retries
var
(
retryInterval
=
5
*
time
.
Second
// time interval between retries
concurrentJobs
=
20
// how many chunks to push simultaneously
)
func
New
(
storer
storage
.
Storer
,
peerSuggester
topology
.
ClosestPeerer
,
pushSyncer
pushsync
.
PushSyncer
,
tagger
*
tags
.
Tags
,
logger
logging
.
Logger
,
tracer
*
tracing
.
Tracer
)
*
Service
{
service
:=
&
Service
{
...
...
@@ -51,23 +54,24 @@ func New(storer storage.Storer, peerSuggester topology.ClosestPeerer, pushSyncer
// chunksWorker is a loop that keeps looking for chunks that are locally uploaded ( by monitoring pushIndex )
// and pushes them to the closest peer and get a receipt.
func
(
s
*
Service
)
chunksWorker
()
{
var
chunks
<-
chan
swarm
.
Chunk
var
unsubscribe
func
()
// timer, initially set to 0 to fall through select case on timer.C for initialisation
timer
:=
time
.
NewTimer
(
0
)
var
(
chunks
<-
chan
swarm
.
Chunk
unsubscribe
func
()
timer
=
time
.
NewTimer
(
0
)
// timer, initially set to 0 to fall through select case on timer.C for initialisation
chunksInBatch
=
-
1
cctx
,
cancel
=
context
.
WithCancel
(
context
.
Background
())
ctx
=
cctx
sem
=
make
(
chan
struct
{},
concurrentJobs
)
inflight
=
make
(
map
[
string
]
struct
{})
mtx
sync
.
Mutex
span
opentracing
.
Span
)
defer
timer
.
Stop
()
defer
close
(
s
.
chunksWorkerQuitC
)
chunksInBatch
:=
-
1
cctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
go
func
()
{
<-
s
.
quit
cancel
()
}()
sem
:=
make
(
chan
struct
{},
10
)
inflight
:=
make
(
map
[
string
]
struct
{})
var
mtx
sync
.
Mutex
var
span
opentracing
.
Span
ctx
:=
cctx
LOOP
:
for
{
...
...
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