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:
rjp 2018-11-22 11:18:50 +00:00 committed by Christian Muehlhaeuser
parent c723963067
commit 1ea99df60d
1 changed files with 7 additions and 0 deletions

View File

@ -170,6 +170,13 @@ 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
}
for _, s := range statuses {
err = parseToot(s, stats)
if err != nil {