mirror of
https://github.com/muesli/mastotool
synced 2025-02-16 11:51:02 +01:00
Combine abort conditions to make the source more readable
This commit is contained in:
parent
639842eea5
commit
08bc3cd37a
17
main.go
17
main.go
@ -148,13 +148,7 @@ func main() {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
// For some reason, either because it's Pleroma or because I have too few toots,
|
||||
// `pg.MaxID` never equals `""` and we get stuck looping forever. Add a simple
|
||||
// break condition on "no statuses fetched" to avoid the issue.
|
||||
if len(statuses) == 0 {
|
||||
break
|
||||
}
|
||||
|
||||
abort := false
|
||||
for _, s := range statuses {
|
||||
err = parseToot(s, stats)
|
||||
if err != nil {
|
||||
@ -165,14 +159,15 @@ func main() {
|
||||
pb.LazyPrint()
|
||||
|
||||
if *maxToots > 0 && len(stats.Toots) >= *maxToots {
|
||||
abort = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if *maxToots > 0 && len(stats.Toots) >= *maxToots {
|
||||
break
|
||||
}
|
||||
if pg.MaxID == "" {
|
||||
// For some reason, either because it's Pleroma or because I have too few toots,
|
||||
// `pg.MaxID` never equals `""` and we get stuck looping forever. Add a simple
|
||||
// break condition on "no statuses fetched" to avoid the issue.
|
||||
if abort || pg.MaxID == "" || len(statuses) == 0 {
|
||||
break
|
||||
}
|
||||
time.Sleep(1000 * time.Millisecond)
|
||||
|
Loading…
x
Reference in New Issue
Block a user