uptime
This commit is contained in:
@ -10,6 +10,7 @@ import (
|
||||
"time"
|
||||
|
||||
"gitea.home.4it.me/dilap54/platiparser/gorm"
|
||||
"gitea.home.4it.me/dilap54/platiparser/healthbeat"
|
||||
"gitea.home.4it.me/dilap54/platiparser/plati"
|
||||
"gitea.home.4it.me/dilap54/platiparser/proxies"
|
||||
uuid "github.com/satori/go.uuid"
|
||||
@ -24,6 +25,8 @@ func init() {
|
||||
var platiCommand = &cli.Command{
|
||||
Name: "plati",
|
||||
Action: func(c *cli.Context) error {
|
||||
timeStart := time.Now()
|
||||
|
||||
categories := openCategories("./categories.json").Content
|
||||
categories = filterBySubstring("Gift", categories)
|
||||
|
||||
@ -34,6 +37,8 @@ var platiCommand = &cli.Command{
|
||||
|
||||
// printNames(categories)
|
||||
|
||||
beatUrl := os.Getenv("UPTIMEKUMA_URL")
|
||||
|
||||
wg, _ := errgroup.WithContext(ctx)
|
||||
wg.SetLimit(10)
|
||||
|
||||
@ -62,7 +67,14 @@ var platiCommand = &cli.Command{
|
||||
|
||||
}
|
||||
|
||||
return wg.Wait()
|
||||
if err := wg.Wait(); err != nil {
|
||||
healthbeat.Beat(beatUrl, "down", err.Error(), int(time.Since(timeStart).Milliseconds()))
|
||||
return err
|
||||
}
|
||||
|
||||
healthbeat.Beat(beatUrl, "up", "OK", int(time.Since(timeStart).Milliseconds()))
|
||||
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user