Skip to content

Commit

Permalink
Update timeout to correspond with ratelimit window
Browse files Browse the repository at this point in the history
  • Loading branch information
rxdn committed Nov 23, 2024
1 parent c6fd5f5 commit b5dfc3e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
10 changes: 2 additions & 8 deletions cmd/app/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func main() {
}

pledgeCh := make(chan map[string]patreon.Patron)
go startPatreonLoop(context.Background(), conf, logger, patreonClient, pledgeCh)
go startPatreonLoop(context.Background(), logger, patreonClient, pledgeCh)

server := server.NewServer(conf, logger.With(zap.String("component", "server")))

Expand All @@ -91,13 +91,7 @@ func main() {
}
}

func startPatreonLoop(
ctx context.Context,
config config.Config,
logger *zap.Logger,
patreonClient *patreon.Client,
ch chan map[string]patreon.Patron,
) {
func startPatreonLoop(ctx context.Context, logger *zap.Logger, patreonClient *patreon.Client, ch chan map[string]patreon.Patron) {
for {
fetchPledges(ctx, logger, patreonClient, ch)
time.Sleep(time.Minute)
Expand Down
2 changes: 1 addition & 1 deletion pkg/patreon/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (c *Client) FetchPledges(ctx context.Context) (map[string]Patron, error) {
// Email -> Data
data := make(map[string]Patron)
for {
res, err := c.FetchPageWithTimeout(ctx, 15*time.Second, url)
res, err := c.FetchPageWithTimeout(ctx, 10*time.Minute, url)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit b5dfc3e

Please sign in to comment.