feat(storage): improve caching in cache driver
All checks were successful
arcad/edge/pipeline/head This commit looks good

ref #20
This commit is contained in:
2023-11-30 19:09:51 +01:00
parent 870db072e0
commit 32f04af138
16 changed files with 312 additions and 103 deletions

View File

@ -31,7 +31,13 @@ func handleAppFetch(w http.ResponseWriter, r *http.Request) {
requestMsg := NewFetchRequestEnvelope(ctx, r.RemoteAddr, url)
bus := edgehttp.ContextBus(ctx)
bus, ok := edgehttp.ContextBus(ctx)
if !ok {
logger.Error(ctx, "could find bus on context")
edgehttp.JSONError(w, http.StatusInternalServerError, edgehttp.ErrCodeInternalError)
return
}
reply, err := bus.Request(ctx, requestMsg)
if err != nil {
@ -79,7 +85,13 @@ func handleAppFetch(w http.ResponseWriter, r *http.Request) {
proxyReq.Header.Add("X-Forwarded-From", r.RemoteAddr)
httpClient := edgehttp.ContextHTTPClient(ctx)
httpClient, ok := edgehttp.ContextHTTPClient(ctx)
if !ok {
logger.Error(ctx, "could find http client on context")
edgehttp.JSONError(w, http.StatusInternalServerError, edgehttp.ErrCodeInternalError)
return
}
res, err := httpClient.Do(proxyReq)
if err != nil {