mirror of
https://github.com/octoleo/restic.git
synced 2025-01-22 22:58:26 +00:00
Use the correct channel for sending errors
This commit is contained in:
parent
86c8328f62
commit
db85ab8aa0
@ -505,13 +505,12 @@ func (c *Checker) Structure(errChan chan<- error, done <-chan struct{}) {
|
|||||||
treeIDChan := make(chan backend.ID)
|
treeIDChan := make(chan backend.ID)
|
||||||
treeJobChan1 := make(chan treeJob)
|
treeJobChan1 := make(chan treeJob)
|
||||||
treeJobChan2 := make(chan treeJob)
|
treeJobChan2 := make(chan treeJob)
|
||||||
treeErrChan := make(chan TreeError)
|
|
||||||
|
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
for i := 0; i < defaultParallelism; i++ {
|
for i := 0; i < defaultParallelism; i++ {
|
||||||
wg.Add(2)
|
wg.Add(2)
|
||||||
go loadTreeWorker(c.repo, treeIDChan, treeJobChan1, done, &wg)
|
go loadTreeWorker(c.repo, treeIDChan, treeJobChan1, done, &wg)
|
||||||
go c.checkTreeWorker(treeJobChan2, treeErrChan, done, &wg)
|
go c.checkTreeWorker(treeJobChan2, errChan, done, &wg)
|
||||||
}
|
}
|
||||||
|
|
||||||
filterTrees(trees, treeIDChan, treeJobChan1, treeJobChan2, done)
|
filterTrees(trees, treeIDChan, treeJobChan1, treeJobChan2, done)
|
||||||
|
@ -79,7 +79,14 @@ func (cmd CmdCheck) Execute(args []string) error {
|
|||||||
|
|
||||||
for err := range errChan {
|
for err := range errChan {
|
||||||
errorsFound = true
|
errorsFound = true
|
||||||
fmt.Fprintf(os.Stderr, "error: %v\n", err)
|
if e, ok := err.(checker.TreeError); ok {
|
||||||
|
fmt.Fprintf(os.Stderr, "error for tree %v:\n", e.ID.Str())
|
||||||
|
for _, treeErr := range e.Errors {
|
||||||
|
fmt.Fprintf(os.Stderr, " %v\n", treeErr)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fmt.Fprintf(os.Stderr, "error: %v\n", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, id := range chkr.UnusedBlobs() {
|
for _, id := range chkr.UnusedBlobs() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user