From 1a35e6dce4b3d50d5a0ca608f3bd33f82caeb7ee Mon Sep 17 00:00:00 2001 From: WardPearce Date: Sat, 27 Apr 2024 18:15:47 +1200 Subject: [PATCH] Close body on 429 & fix docker file with use of fiber prefork --- Dockerfile | 5 ++++- main.go | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index c63f5bb..1fce12a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,5 +15,8 @@ RUN apk --no-cache add --no-check-certificate ca-certificates \ COPY --from=build /app/main /ryd-proxy +RUN apk add dumb-init +ENTRYPOINT ["/usr/bin/dumb-init", "--"] + EXPOSE 3000 -CMD [ "/ryd-proxy" ] +CMD "/ryd-proxy" diff --git a/main.go b/main.go index 9952062..cd2a0f3 100644 --- a/main.go +++ b/main.go @@ -91,12 +91,16 @@ func getVotes(c *fiber.Ctx, videoId string) error { resp, err := client.Do(req) - if err != nil || resp.StatusCode == 429 { + if err != nil { continue } defer resp.Body.Close() + if resp.StatusCode == 429 { + continue + } + ce := resp.Header.Get("Content-Encoding") var stream io.Reader