Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-bitswap
Commits
d44a5f67
Unverified
Commit
d44a5f67
authored
Apr 10, 2020
by
Steven Allen
Committed by
GitHub
Apr 10, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: start score worker along with other engine workers (#344)
parent
38114a67
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
internal/decision/engine.go
internal/decision/engine.go
+3
-3
No files found.
internal/decision/engine.go
View file @
d44a5f67
...
...
@@ -197,7 +197,6 @@ func newEngine(ctx context.Context, bs bstore.Blockstore, peerTagger PeerTagger,
peertaskqueue
.
OnPeerRemovedHook
(
e
.
onPeerRemoved
),
peertaskqueue
.
TaskMerger
(
newTaskMerger
()),
peertaskqueue
.
IgnoreFreezing
(
true
))
go
e
.
scoreWorker
(
ctx
)
return
e
}
...
...
@@ -215,6 +214,7 @@ func (e *Engine) SetSendDontHaves(send bool) {
func
(
e
*
Engine
)
StartWorkers
(
ctx
context
.
Context
,
px
process
.
Process
)
{
// Start up blockstore manager
e
.
bsm
.
start
(
px
)
px
.
Go
(
e
.
scoreWorker
)
for
i
:=
0
;
i
<
e
.
taskWorkerCount
;
i
++
{
px
.
Go
(
func
(
px
process
.
Process
)
{
...
...
@@ -240,7 +240,7 @@ func (e *Engine) StartWorkers(ctx context.Context, px process.Process) {
// To calculate the final score, we sum the short-term and long-term scores then
// adjust it ±25% based on our debt ratio. Peers that have historically been
// more useful to us than we are to them get the highest score.
func
(
e
*
Engine
)
scoreWorker
(
ctx
context
.
Context
)
{
func
(
e
*
Engine
)
scoreWorker
(
px
process
.
Process
)
{
ticker
:=
time
.
NewTicker
(
e
.
peerSampleInterval
)
defer
ticker
.
Stop
()
...
...
@@ -257,7 +257,7 @@ func (e *Engine) scoreWorker(ctx context.Context) {
var
now
time
.
Time
select
{
case
now
=
<-
ticker
.
C
:
case
<-
ctx
.
Done
()
:
case
<-
px
.
Closing
()
:
return
}
...
...
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