Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change to approprite error msg when directory not found in cache intel #73

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cache/rebuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func (r rebuilder) Rebuild(srcs []string) error {
wg.Wait()

if errs.Err() != nil {
return fmt.Errorf("rebuild failed, %w", errs)
level.Warn(r.logger).Log("msg", "ignore archival, ", errs.Err())

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The message is unclear IMO. When will the Err() be not nil? We should be checking for the case where the path directory doesn't exist and only then ignore it instead of ignoring it for all errors. Also let's print it clearly: path %s doesn't exist. Ignoring save to cache or similar.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should only just print warning when it's auto detected. This will change old behavior right?

}

level.Info(r.logger).Log("msg", "cache built", "took", time.Since(now))
Expand Down Expand Up @@ -140,7 +140,7 @@ func (r rebuilder) rebuild(src, dst string) (err error) {
tr := io.TeeReader(pr, sw)

if err := r.s.Put(dst, tr); err != nil {
err = fmt.Errorf("upload file, pipe reader failed, %w", err)
err = fmt.Errorf("failed to upload file to cache storage, %w", err)
if err := pr.CloseWithError(err); err != nil {
level.Error(r.logger).Log("msg", "pr close", "err", err)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use a better message instead of "pr close"

}
Expand Down
2 changes: 1 addition & 1 deletion cache/restorer.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func (r restorer) restore(src, dst string) (err error) {

written, err := r.a.Extract(dst, pr)
if err != nil {
err = fmt.Errorf("extract files from downloaded archive, pipe reader failed, %w", err)
err = fmt.Errorf("failed to extract files from downloaded archive, %w", err)
if err := pr.CloseWithError(err); err != nil {
level.Error(r.logger).Log("msg", "pr close", "err", err)
}
Expand Down