Close body on 429 & fix docker file with use of fiber prefork

This commit is contained in:
WardPearce 2024-04-27 18:15:47 +12:00
parent fb2956e24b
commit 1a35e6dce4
2 changed files with 9 additions and 2 deletions

View file

@ -15,5 +15,8 @@ RUN apk --no-cache add --no-check-certificate ca-certificates \
COPY --from=build /app/main /ryd-proxy COPY --from=build /app/main /ryd-proxy
RUN apk add dumb-init
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
EXPOSE 3000 EXPOSE 3000
CMD [ "/ryd-proxy" ] CMD "/ryd-proxy"

View file

@ -91,12 +91,16 @@ func getVotes(c *fiber.Ctx, videoId string) error {
resp, err := client.Do(req) resp, err := client.Do(req)
if err != nil || resp.StatusCode == 429 { if err != nil {
continue continue
} }
defer resp.Body.Close() defer resp.Body.Close()
if resp.StatusCode == 429 {
continue
}
ce := resp.Header.Get("Content-Encoding") ce := resp.Header.Get("Content-Encoding")
var stream io.Reader var stream io.Reader