Skip to content

Commit

Permalink
sqlserver: special url for proxy health-checks
Browse files Browse the repository at this point in the history
Signed-off-by: Anisur Rahman <anisur@appscode.com>
  • Loading branch information
anisurrahman75 authored and tamalsaha committed May 24, 2024
1 parent 4b07f1d commit 0fccf8f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion internal/databases/sqlserver/blob/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ const BlockReadCacheSize = 16

const MaxCacheBlockSize = 16 * 1024 * 1024 // 16M

const InternalPingURL = "/__walg_g_ping__"

type Server struct {
folder storage.Folder
certFile string
Expand Down Expand Up @@ -150,7 +152,7 @@ func (bs *Server) RunBackground(ctx context.Context, cancel context.CancelFunc)
func (bs *Server) WaitReady(ctx context.Context, timeout time.Duration) error {
sctx, cancel := context.WithTimeout(ctx, timeout)
defer cancel()
url := fmt.Sprintf("https://%s/", bs.endpoint)
url := fmt.Sprintf("https://%s%s", bs.endpoint, InternalPingURL)
c := http.Client{Timeout: 100 * time.Millisecond}
t := time.NewTicker(200 * time.Millisecond)
for {
Expand Down Expand Up @@ -207,6 +209,10 @@ func (bs *Server) ServeHTTP2(w http.ResponseWriter, req *http.Request) {
w.WriteHeader(http.StatusInternalServerError)
}
}()
if req.URL.Path == InternalPingURL {
w.WriteHeader(http.StatusOK)
return
}
// default headers
w.Header().Set("Content-Type", "application/octet-stream")
w.Header().Set("Content-Length", "0")
Expand Down

0 comments on commit 0fccf8f

Please sign in to comment.