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.
master
Ted Unangst 5 years ago
parent 2ef8cc8a80
commit 2a197e157c

@ -22,6 +22,7 @@ import (
"fmt"
"io"
"log"
notrand "math/rand"
"net/http"
"net/url"
"os"
@ -473,6 +474,15 @@ func xonkxonk(user *WhatAbout, item junk.Junk, origin string) *Honk {
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"

@ -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.

Loading…
Cancel
Save