Skip to content

Commit

Permalink
Loop.
Browse files Browse the repository at this point in the history
  • Loading branch information
floitsch committed Jul 3, 2024
1 parent 9824d8e commit 6b63ccb
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,29 @@ func main() {
startCtx, _ := context.WithTimeout(context.Background(), app.StartTimeout())
app.Start(startCtx)
go func() {
// Make sure the rest is up and running.
time.Sleep(10 * time.Second)
// Connect to our own server (without a timeout) and see if we are running.
client := http.Client{
Timeout: 9999 * time.Second,
}
url := "http://localhost:8733/github.com/toitware/[email protected]/docs/roboto/library-summary"
println("Contacting", url)
response, err := client.Get(url)
if err != nil || response.StatusCode != 200 {
println("************************* TEST FAILED - Failed to load toitdoc ******************", err)
if response != nil {
println("Status", response.Status)
for {
println("Contacting", url)
response, err := client.Get(url)
if response.StatusCode == 404 {
time.Sleep(1 * time.Second)
continue
}
} else {
println("*************************** TEST SUCCESS - Loaded toitdoc ************************", response.Status)
if err != nil || response.StatusCode != 200 {
println("************************* TEST FAILED - Failed to load toitdoc ******************", err)
if response != nil {
println("Status", response.Status)
}
} else {
println("*************************** TEST SUCCESS - Loaded toitdoc ************************", response.Status)
}
stopCtx, _ := context.WithTimeout(context.Background(), app.StopTimeout())
app.Stop(stopCtx)
}
stopCtx, _ := context.WithTimeout(context.Background(), app.StopTimeout())
app.Stop(stopCtx)
}()
// Wait for the app to be stopped.
<-app.Done()
Expand Down

0 comments on commit 6b63ccb

Please sign in to comment.