ADD cache to response on browser
All checks were successful
dev test / test (push) Successful in 7s
dev test / vulnCheck (push) Successful in 12s
dev test / Ci-Lint (push) Successful in 10s
${{ github.actor }} executed Build Push Prod / build (push) Successful in 3m21s
${{ github.actor }} executed Build Push Prod / deploy (push) Successful in 18s
All checks were successful
dev test / test (push) Successful in 7s
dev test / vulnCheck (push) Successful in 12s
dev test / Ci-Lint (push) Successful in 10s
${{ github.actor }} executed Build Push Prod / build (push) Successful in 3m21s
${{ github.actor }} executed Build Push Prod / deploy (push) Successful in 18s
This commit is contained in:
parent
0dbbc4b045
commit
2a7869bf1f
@ -50,7 +50,7 @@ func (api *API) GetInstitutionHistory(w http.ResponseWriter, r *http.Request) {
|
|||||||
http.Error(w, "incorrect time amount", http.StatusNotFound)
|
http.Error(w, "incorrect time amount", http.StatusNotFound)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
w.Header().Add("Cache-Control", "max-age=600")
|
||||||
if timeFrame == "now" {
|
if timeFrame == "now" {
|
||||||
hist, err := api.dolar.GetLatest(inst)
|
hist, err := api.dolar.GetLatest(inst)
|
||||||
//hist, err := api.db.GetLastPrice(inst)
|
//hist, err := api.db.GetLastPrice(inst)
|
||||||
@ -165,6 +165,7 @@ func (api *API) GetInstNames(w http.ResponseWriter, r *http.Request) {
|
|||||||
searchResult.Results = append(searchResult.Results, &inst)
|
searchResult.Results = append(searchResult.Results, &inst)
|
||||||
}
|
}
|
||||||
api.log.Info("institutions", "list", res)
|
api.log.Info("institutions", "list", res)
|
||||||
|
w.Header().Add("Cache-Control", "max-age=86400")
|
||||||
if fType == "html" {
|
if fType == "html" {
|
||||||
switch resource {
|
switch resource {
|
||||||
case "card":
|
case "card":
|
||||||
@ -197,10 +198,12 @@ func (api *API) GetLatestPrice(w http.ResponseWriter, r *http.Request) {
|
|||||||
api.log.Error("geting latest price", "error", err)
|
api.log.Error("geting latest price", "error", err)
|
||||||
http.NotFound(w, r)
|
http.NotFound(w, r)
|
||||||
}
|
}
|
||||||
|
w.Header().Add("Cache-Control", "max-age=600")
|
||||||
_ = api.templ.ExecuteTemplate(w, "latest-price", price)
|
_ = api.templ.ExecuteTemplate(w, "latest-price", price)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (api *API) GetAllLatestPrice(w http.ResponseWriter, r *http.Request) {
|
func (api *API) GetAllLatestPrice(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
bancos, err := api.dolar.GetInstByType("bancos")
|
bancos, err := api.dolar.GetInstByType("bancos")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
api.log.Error("geting inst", "error", err)
|
api.log.Error("geting inst", "error", err)
|
||||||
@ -225,5 +228,6 @@ func (api *API) GetAllLatestPrice(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
instLastPriceList = append(instLastPriceList, in)
|
instLastPriceList = append(instLastPriceList, in)
|
||||||
}
|
}
|
||||||
|
w.Header().Add("Cache-Control", "max-age=600")
|
||||||
_ = api.templ.ExecuteTemplate(w, "latest-price", instLastPriceList)
|
_ = api.templ.ExecuteTemplate(w, "latest-price", instLastPriceList)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user