diff --git a/app/cron.go b/app/cron.go index 7e62900..15b5cbd 100644 --- a/app/cron.go +++ b/app/cron.go @@ -5,7 +5,6 @@ import ( ) func Cron() { - gocron.Every(10).Minutes().Do(CrawlTGChannel) - + _ = gocron.Every(10).Minutes().Do(CrawlTGChannel) <-gocron.Start() } diff --git a/app/task.go b/app/task.go index 031fc31..d7205bb 100644 --- a/app/task.go +++ b/app/task.go @@ -41,7 +41,7 @@ func CrawlTGChannel() { num := len(proxies) for i := 0; i < num; i++ { - proxies[i].SetName("@tgbotlist_" + strconv.Itoa(rand.Int())) + proxies[i].SetName(strconv.Itoa(rand.Int())) } cache.SetProxies(proxies) cache.SetString("clashproxies", provider.Clash{Proxies: proxies}.Provide()) diff --git a/main.go b/main.go index 953b314..1c58bdf 100644 --- a/main.go +++ b/main.go @@ -8,6 +8,7 @@ import ( ) func main() { + go app.Cron() fmt.Println("Do the first crawl...") app.CrawlTGChannel() api.Run()