Skip to content

Commit

Permalink
chore: prevent to sleep
Browse files Browse the repository at this point in the history
  • Loading branch information
fanhousanbu committed Mar 17, 2024
1 parent b392da2 commit b17d720
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ package main
import (
"fmt"
"github.com/assimon/captcha-bot/bootstrap"
"io"
"net/http"
"time"
)

func main() {
Expand All @@ -15,5 +17,19 @@ func main() {
http.ListenAndServe(":80", nil)
}()

go func() {
t := time.NewTimer(time.Second * 10)
for {
if resp, err := http.Get("https://captcha-bot-zg9p.onrender.com/healthz"); err != nil {
fmt.Println(fmt.Sprintf("err:%v", err))
} else {
if b, err := io.ReadAll(resp.Body); err == nil {
fmt.Println("health: " + string(b))
}
}
<-t.C
}
}()

bootstrap.Start()
}

0 comments on commit b17d720

Please sign in to comment.