Skip to content

Commit 24893be

Browse files
authored
don't check db on /health (#148)
1 parent 0bccd85 commit 24893be

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

pkg/secretmessage/handle_health.go

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,28 @@ import (
55
"os"
66

77
"github.com/gin-gonic/gin"
8-
"go.uber.org/zap"
98
)
109

1110
func (ctl *PublicController) HandleHealth(c *gin.Context) {
1211
version, ok := os.LookupEnv("NF_DEPLOYMENT_SHA")
1312
if !ok {
1413
version = "dev"
1514
}
16-
db, err := ctl.db.DB()
17-
if err != nil {
18-
ctl.logger.Error("error retrieving database connection", zap.Error(err))
19-
c.AbortWithStatusJSON(http.StatusServiceUnavailable, gin.H{"status": "DOWN", "sha": version})
20-
return
21-
}
2215

23-
err = db.PingContext(c.Request.Context())
24-
if err != nil {
25-
ctl.logger.Error("error pinging database", zap.Error(err))
26-
c.AbortWithStatusJSON(http.StatusServiceUnavailable, gin.H{"status": "DOWN", "sha": version})
27-
return
28-
}
16+
// Neon removed their free tier. It now costs me money to keep the database up, so let it sleep to save costs.
17+
18+
// db, err := ctl.db.DB()
19+
// if err != nil {
20+
// log.Error(err)
21+
// c.AbortWithStatusJSON(http.StatusServiceUnavailable, gin.H{"status": "DOWN", "sha": version})
22+
// return
23+
// }
24+
25+
// err = db.PingContext(c.Request.Context())
26+
// if err != nil {
27+
// log.Error(err)
28+
// c.AbortWithStatusJSON(http.StatusServiceUnavailable, gin.H{"status": "DOWN", "sha": version})
29+
// return
30+
// }
2931
c.JSON(http.StatusOK, gin.H{"status": "UP", "sha": version})
3032
}

0 commit comments

Comments
 (0)