Skip to content
This repository was archived by the owner on Mar 27, 2024. It is now read-only.

Commit 46e7729

Browse files
author
Priya Wadhwa
committed
Save temp file in cache dir
1 parent e96ba18 commit 46e7729

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pkg/cache/file_cache.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ func (c *FileCache) HasLayer(layer types.BlobInfo) bool {
5757
func (c *FileCache) SetLayer(layer types.BlobInfo, r io.Reader) (io.ReadCloser, error) {
5858
layerId := layer.Digest.String()
5959
fullpath := filepath.Join(c.RootDir, layerId)
60-
// Write the entry atomically. First write it to a .tmp name, then rename to the correct one.
61-
f, err := ioutil.TempFile("", "")
60+
// Write the entry atomically. First write it to a temporary name, then rename to the correct one.
61+
f, err := ioutil.TempFile(c.RootDir, "")
6262
if err != nil {
6363
return nil, err
6464
}
@@ -96,6 +96,7 @@ func (c *FileCache) GetBlob(bi types.BlobInfo) (io.ReadCloser, int64, error) {
9696
}
9797
r, err = c.SetLayer(bi, r)
9898
if err != nil {
99+
logrus.Errorf("Error setting layer %s in cache: %v", bi.Digest, err)
99100
return nil, 0, c.Invalidate(bi)
100101
}
101102
return r, size, err

0 commit comments

Comments
 (0)