Skip caching user stats on CDN level

The problem is that url does not have user id in it (we still cache inside)
This commit is contained in:
Taras Kushnir
2025-12-08 09:00:03 +01:00
parent 9151c22370
commit cf56507465

View File

@@ -686,11 +686,6 @@ func (s *Server) getAccountStats(w http.ResponseWriter, r *http.Request) {
}
timeFrom := time.Now().UTC().AddDate(-1 /*years*/, 0 /*months*/, 0 /*days*/).Truncate(24 * time.Hour)
etag := common.GenerateETag(strconv.Itoa(int(user.ID)), timeFrom.Format(time.RFC3339))
if etagHeader := r.Header.Get(common.HeaderIfNoneMatch); len(etagHeader) > 0 && (etagHeader == etag) {
w.WriteHeader(http.StatusNotModified)
return
}
type point struct {
Date int64 `json:"x"`
@@ -722,12 +717,7 @@ func (s *Server) getAccountStats(w http.ResponseWriter, r *http.Request) {
Data: data,
}
cacheHeaders := map[string][]string{
common.HeaderETag: []string{etag},
common.HeaderCacheControl: common.PrivateCacheControl1m,
}
common.SendJSONResponse(ctx, w, response, cacheHeaders)
common.SendJSONResponse(ctx, w, response, common.NoCacheHeaders)
}
func (s *Server) createUsageSettingsModel(ctx context.Context, user *dbgen.User) *settingsUsageRenderContext {