check if infinite loop

This commit is contained in:
Andriy Cherniy 2024-01-05 21:49:50 +02:00
parent 063083a096
commit 19349e08f7

32
main.go
View file

@ -100,28 +100,28 @@ func main() {
ClientSecret: os.Getenv("MASTODON_CLIENT_SECRET"), ClientSecret: os.Getenv("MASTODON_CLIENT_SECRET"),
AccessToken: os.Getenv("MASTODON_ACCESS_TOKEN"), AccessToken: os.Getenv("MASTODON_ACCESS_TOKEN"),
}) })
masto_user, err := masto_client.GetAccountCurrentUser(ctx) // masto_user, err := masto_client.GetAccountCurrentUser(ctx)
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }
var subscribers []*mastodon.Account var subscribers []*mastodon.Account
var pg mastodon.Pagination // var pg mastodon.Pagination
log.Info("test") // log.Info("test")
log.Debug("get followers list") // log.Debug("get followers list")
for { // for {
fs, err := masto_client.GetAccountFollowers(context.Background(), masto_user.ID, &pg) // fs, err := masto_client.GetAccountFollowers(context.Background(), masto_user.ID, &pg)
if err != nil { // if err != nil {
log.Fatal(err) // log.Fatal(err)
} // }
subscribers = append(subscribers, fs...) // subscribers = append(subscribers, fs...)
log.Debug(pg) // log.Debug(pg)
log.Debug(pg.MaxID) // log.Debug(pg.MaxID)
if pg.MaxID == "" { // if pg.MaxID == "" {
break // break
} // }
} // }
// log.Println(my_account) // log.Println(my_account)