mirror of https://github.com/muesli/mastotool
Loop break for infinite loop problem
Either Pleroma or my handful of toots causes the status-fetching-with-pagination to get stuck in an infinite loop. Seems to be a problem in the underlying mastodon library rather than this code. This is an easier fix for now; to break out if we fetched no statuses (i.e we ran out.)
This commit is contained in:
parent
c723963067
commit
2f0fb0f610
7
main.go
7
main.go
|
@ -170,6 +170,13 @@ func main() {
|
||||||
panic(err)
|
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
|
||||||
|
}
|
||||||
|
|
||||||
for _, s := range statuses {
|
for _, s := range statuses {
|
||||||
err = parseToot(s, stats)
|
err = parseToot(s, stats)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue