every time I try to get a post from pixelfed, I get a 502 error. workaround by sleeping and trying again when the PHP cools down.
Ted Unangst tedu@tedunangst.com
Fri, 02 Aug 2019 10:45:42 -0400
2 files changed,
12 insertions(+),
0 deletions(-)
M
activity.go
→
activity.go
@@ -22,6 +22,7 @@ "database/sql"
"fmt" "io" "log" + notrand "math/rand" "net/http" "net/url" "os"@@ -473,6 +474,15 @@ log.Printf("getting bonk: %s", xid)
obj, err = GetJunk(xid) if err != nil { log.Printf("error regetting: %s", err) + if err.Error() == "http get status: 502" { + time.Sleep(time.Duration(60+notrand.Int63n(60)) * time.Second) + obj, err = GetJunk(xid) + if err != nil { + log.Printf("still couldn't get it") + } else { + log.Printf("retry success!") + } + } } origin = originate(xid) what = "bonk"
M
docs/changelog.txt
→
docs/changelog.txt
@@ -2,6 +2,8 @@ changelog
-- next ++ Add another retry to workaround pixelfed's general unreliability. + + Attached images are not lost when previewing. - Remove sensitivity to spicy peppers.