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-dms3
Commits
2997f48a
Commit
2997f48a
authored
Nov 21, 2017
by
Steven Allen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix goroutine leaks in repo commands
License: MIT Signed-off-by:
Steven Allen
<
steven@stebalien.com
>
parent
016b0053
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
6 deletions
+29
-6
core/commands/repo.go
core/commands/repo.go
+29
-6
No files found.
core/commands/repo.go
View file @
2997f48a
...
...
@@ -85,10 +85,18 @@ order to reclaim hard disk space.
errs
:=
false
for
res
:=
range
gcOutChan
{
if
res
.
Error
!=
nil
{
outChan
<-
&
GcResult
{
Error
:
res
.
Error
.
Error
()}
select
{
case
outChan
<-
&
GcResult
{
Error
:
res
.
Error
.
Error
()}
:
case
<-
req
.
Context
()
.
Done
()
:
return
}
errs
=
true
}
else
{
outChan
<-
&
GcResult
{
Key
:
res
.
KeyRemoved
}
select
{
case
outChan
<-
&
GcResult
{
Key
:
res
.
KeyRemoved
}
:
case
<-
req
.
Context
()
.
Done
()
:
return
}
}
}
if
errs
{
...
...
@@ -96,7 +104,10 @@ order to reclaim hard disk space.
}
}
else
{
err
:=
corerepo
.
CollectResult
(
req
.
Context
(),
gcOutChan
,
func
(
k
*
cid
.
Cid
)
{
outChan
<-
&
GcResult
{
Key
:
k
}
select
{
case
outChan
<-
&
GcResult
{
Key
:
k
}
:
case
<-
req
.
Context
()
.
Done
()
:
}
})
if
err
!=
nil
{
res
.
SetError
(
err
,
cmdkit
.
ErrNormal
)
...
...
@@ -291,17 +302,29 @@ var repoVerifyCmd = &oldcmds.Command{
for
k
:=
range
keys
{
_
,
err
:=
bs
.
Get
(
k
)
if
err
!=
nil
{
out
<-
&
VerifyProgress
{
select
{
case
out
<-
&
VerifyProgress
{
Msg
:
fmt
.
Sprintf
(
"block %s was corrupt (%s)"
,
k
,
err
),
}
:
case
<-
req
.
Context
()
.
Done
()
:
return
}
fails
++
}
i
++
out
<-
&
VerifyProgress
{
Progress
:
i
}
select
{
case
out
<-
&
VerifyProgress
{
Progress
:
i
}
:
case
<-
req
.
Context
()
.
Done
()
:
return
}
}
if
fails
==
0
{
out
<-
&
VerifyProgress
{
Msg
:
"verify complete, all blocks validated."
}
select
{
case
out
<-
&
VerifyProgress
{
Msg
:
"verify complete, all blocks validated."
}
:
case
<-
req
.
Context
()
.
Done
()
:
return
}
}
else
{
res
.
SetError
(
fmt
.
Errorf
(
"verify complete, some blocks were corrupt"
),
cmdkit
.
ErrNormal
)
}
...
...
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