Added light cache-control headers on miner output on api and web
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
DataHoarder 2023-05-24 15:10:07 +02:00
parent a2b701e87b
commit 5e9bc7e825
Signed by: DataHoarder
SSH key fingerprint: SHA256:OLTRf6Fl87G52SiR7sWLGNzlJt4WOX+tfI2yxo0z7xk
2 changed files with 13 additions and 0 deletions

View file

@ -411,6 +411,13 @@ func main() {
}
writer.Header().Set("Content-Type", "application/json; charset=utf-8")
if lastShareTimestamp < uint64(time.Now().Unix()-3600) {
writer.Header().Set("cache-control", "public; max-age=600")
} else {
writer.Header().Set("cache-control", "public; max-age=60")
}
writer.WriteHeader(http.StatusOK)
buf, _ := encodeJson(request, utils2.MinerInfoResult{
Id: miner.Id(),

View file

@ -1332,6 +1332,12 @@ func main() {
ctx["share_sweeps"] = likelySweeps
ctx["share_sweeps_count"] = sweepsCount
if block.Timestamp < uint64(time.Now().Unix()-60) {
writer.Header().Set("cache-control", "public; max-age=604800")
} else {
writer.Header().Set("cache-control", "public; max-age=60")
}
render(request, writer, "share.html", ctx)
})