Skip to content

Commit 8a4436a

Browse files
eplightningmostynb
authored andcommitted
[azblobproxy] handle 404 responses properly
1 parent f46bc20 commit 8a4436a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

cache/azblobproxy/azblobproxy.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"fmt"
77
"io"
88
"log"
9+
"net/http"
910
"path"
1011
"time"
1112

@@ -75,6 +76,13 @@ func (c *azBlobCache) Get(ctx context.Context, kind cache.EntryKind, hash string
7576

7677
resp, err := client.DownloadStream(ctx, nil)
7778
if err != nil {
79+
var azErr *azcore.ResponseError
80+
if errors.As(err, &azErr) && azErr != nil && azErr.StatusCode == http.StatusNotFound {
81+
cacheMisses.Inc()
82+
logResponse(c.accessLogger, "DOWNLOAD", c.storageAccount, c.container, key, errNotFound)
83+
return nil, -1, nil
84+
}
85+
7886
cacheMisses.Inc()
7987
logResponse(c.accessLogger, "DOWNLOAD", c.storageAccount, c.container, key, err)
8088
return nil, -1, err

0 commit comments

Comments
 (0)