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-blockservice
Commits
d630e983
Commit
d630e983
authored
Jan 20, 2015
by
Brian Tiger Chow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
one worker
parent
c68129e9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
23 deletions
+21
-23
worker/worker.go
worker/worker.go
+21
-23
No files found.
worker/worker.go
View file @
d630e983
...
...
@@ -114,32 +114,30 @@ func (w *Worker) start(c Config) {
}
})
for
i
:=
0
;
i
<
c
.
NumWorkers
;
i
++
{
// reads from |workerChan| until process closes
w
.
process
.
Go
(
func
(
proc
process
.
Process
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
// shuts down an in-progress HasBlock operation
proc
.
Go
(
func
(
proc
process
.
Process
)
{
<-
proc
.
Closing
()
cancel
()
})
for
{
select
{
case
<-
proc
.
Closing
()
:
// reads from |workerChan| until process closes
w
.
process
.
Go
(
func
(
proc
process
.
Process
)
{
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
// shuts down an in-progress HasBlock operation
proc
.
Go
(
func
(
proc
process
.
Process
)
{
<-
proc
.
Closing
()
cancel
()
})
for
{
select
{
case
<-
proc
.
Closing
()
:
return
case
block
,
ok
:=
<-
workerChan
:
if
!
ok
{
return
case
block
,
ok
:=
<-
workerChan
:
if
!
ok
{
return
}
if
err
:=
w
.
exchange
.
HasBlock
(
ctx
,
block
);
err
!=
nil
{
// TODO log event?
}
}
if
err
:=
w
.
exchange
.
HasBlock
(
ctx
,
block
);
err
!=
nil
{
// TODO log event?
}
}
}
)
}
}
}
)
}
type
BlockList
struct
{
...
...
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