Skip to content

Commit

Permalink
allow more retries and harden ratelimit for lufthansa
Browse files Browse the repository at this point in the history
  • Loading branch information
its-felix committed Jun 13, 2024
1 parent e654e55 commit aa3fdeb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions go/common/lufthansa/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ func doRequestFlightSchedules[T any](ctx context.Context, c *Client, airlines []

q.Set("timeMode", "UTC")

const maxRetries = 5
const maxRetries = 10
errs := make([]error, 0, maxRetries)

for len(errs) < maxRetries {
Expand Down Expand Up @@ -293,7 +293,7 @@ func doRequestPage[T pagedResource[D], D any](ctx context.Context, c *Client, me
q.Set("limit", strconv.Itoa(pageSize))
q.Set("offset", strconv.Itoa(offset))

const maxRetries = 5
const maxRetries = 10
errs := make([]error, 0, maxRetries)

for {
Expand Down
2 changes: 1 addition & 1 deletion go/cron/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func newHandler(s3c *s3.Client) func(ctx context.Context, event InputEvent) (jso
lhc := lufthansa.NewClient(
lhClientId,
lhClientSecret,
lufthansa.WithRateLimiter(rate.NewLimiter(rate.Every(time.Hour)*990, 3)),
lufthansa.WithRateLimiter(rate.NewLimiter(rate.Every(time.Hour)*490, 1)),
)

lCountriesAction := action.NewLoadMetadataAction(s3c, lhc, (*lufthansa.Client).CountriesRaw, "countries")
Expand Down

0 comments on commit aa3fdeb

Please sign in to comment.