Skip to content

Commit

Permalink
🐛 Fixes 5 by sending a redirect after 1 sec
Browse files Browse the repository at this point in the history
  • Loading branch information
adyanth committed Jun 21, 2021
1 parent f1d0a42 commit e9e5024
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,17 @@ func (e *Manager) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
e.request, _ = buildRequest(e.serviceUrl, e.name, e.timeout, host, path)
fmt.Println("Request set to ", e.request)
}
status, err := getServiceStatus(e.request)
for err == nil && status == "starting" {
status, err = getServiceStatus(e.request)

starting := false
var status string
var err error
for status, err = getServiceStatus(e.request); err == nil && status == "starting"; status, err = getServiceStatus(e.request) {
starting = true
}

if starting {
time.Sleep(1 * time.Second)
http.Redirect(rw, req, req.URL.Path, http.StatusTemporaryRedirect)
}

if err != nil {
Expand Down

1 comment on commit e9e5024

@adyanth
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes #5

Please sign in to comment.