| OLD | NEW |
| 1 // Copyright 2017 The LUCI Authors. All rights reserved. | 1 // Copyright 2017 The LUCI Authors. All rights reserved. |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 | 2 // Use of this source code is governed under the Apache License, Version 2.0 |
| 3 // that can be found in the LICENSE file. | 3 // that can be found in the LICENSE file. |
| 4 | 4 |
| 5 package venv | 5 package venv |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "github.com/danjacques/gofslock/fslock" | 8 "github.com/danjacques/gofslock/fslock" |
| 9 "golang.org/x/net/context" | 9 "golang.org/x/net/context" |
| 10 | 10 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 if cfg.MaxPrunesPerSweep > 0 && totalPruned >= cfg.MaxPr
unesPerSweep { | 77 if cfg.MaxPrunesPerSweep > 0 && totalPruned >= cfg.MaxPr
unesPerSweep { |
| 78 logging.Debugf(c, "Hit prune limit of %d.", cfg.
MaxPrunesPerSweep) | 78 logging.Debugf(c, "Hit prune limit of %d.", cfg.
MaxPrunesPerSweep) |
| 79 hitLimitStr = " (limit)" | 79 hitLimitStr = " (limit)" |
| 80 cancelFunc() | 80 cancelFunc() |
| 81 } | 81 } |
| 82 | 82 |
| 83 case fslock.ErrLockHeld: | 83 case fslock.ErrLockHeld: |
| 84 logging.WithError(err).Debugf(c, "Environment [%s] is in
use.", e.Name) | 84 logging.WithError(err).Debugf(c, "Environment [%s] is in
use.", e.Name) |
| 85 | 85 |
| 86 default: | 86 default: |
| 87 » » » err = errors.Annotate(err).Reason("failed to prune file:
%(name)s"). | 87 » » » err = errors.Annotate(err, "failed to prune file: %s", e
.Name). |
| 88 » » » » D("name", e.Name). | 88 » » » » InternalReason("dir(%q)", e.Config.BaseDir).Err(
) |
| 89 » » » » D("dir", e.Config.BaseDir). | |
| 90 » » » » Err() | |
| 91 allErrs = append(allErrs, err) | 89 allErrs = append(allErrs, err) |
| 92 } | 90 } |
| 93 return nil | 91 return nil |
| 94 }) | 92 }) |
| 95 if err != nil { | 93 if err != nil { |
| 96 // Error during iteration. | 94 // Error during iteration. |
| 97 return err | 95 return err |
| 98 } | 96 } |
| 99 | 97 |
| 100 logging.Infof(c, "Pruned %d environment(s)%s with %d error(s)", totalPru
ned, hitLimitStr, len(allErrs)) | 98 logging.Infof(c, "Pruned %d environment(s)%s with %d error(s)", totalPru
ned, hitLimitStr, len(allErrs)) |
| 101 if len(allErrs) > 0 { | 99 if len(allErrs) > 0 { |
| 102 return allErrs | 100 return allErrs |
| 103 } | 101 } |
| 104 return nil | 102 return nil |
| 105 } | 103 } |
| OLD | NEW |