Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.23.4
toolchain go1.24.0

require (
github.com/conductorone/baton-sdk v0.3.28
github.com/conductorone/baton-sdk v0.3.29
github.com/ennyjfrick/ruleguard-logfatal v0.0.2
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0
github.com/quasilyte/go-ruleguard/dsl v0.3.22
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyY
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/conductorone/baton-sdk v0.3.28 h1:tvOpgWr9MjBaG/eXj17oGl9EGGe1/yC5MMQTCcfQPhI=
github.com/conductorone/baton-sdk v0.3.28/go.mod h1:L55WO3ERMx1mfpjDgwK3jWNRGRF2E76WrQHmW6ev8VY=
github.com/conductorone/baton-sdk v0.3.29 h1:HcWmyd28bi9vYLziiVUEWx+ODXaqPHsETcS4E1BQE80=
github.com/conductorone/baton-sdk v0.3.29/go.mod h1:L55WO3ERMx1mfpjDgwK3jWNRGRF2E76WrQHmW6ev8VY=
github.com/conductorone/dpop v0.2.3 h1:s91U3845GHQ6P6FWrdNr2SEOy1ES/jcFs1JtKSl2S+o=
github.com/conductorone/dpop v0.2.3/go.mod h1:gyo8TtzB9SCFCsjsICH4IaLZ7y64CcrDXMOPBwfq/3s=
github.com/conductorone/dpop/integrations/dpop_grpc v0.2.3 h1:kLMCNIh0Mo2vbvvkCmJ3ixsPbXEJ6HPcW53Ku9yje3s=
Expand Down
6 changes: 5 additions & 1 deletion pkg/connector/tickets.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,12 @@ func (ln *Linear) ListTicketSchemas(ctx context.Context, p *pagination.Token) ([
if err != nil {
return nil, "", nil, err
}
l := ctxzap.Extract(ctx)

teams, nextToken, _, rlData, err := ln.client.ListTeamWorkflowStates(ctx, linear.GetTeamsVars{After: bag.PageToken(), First: resourcePageSize})
annotations.WithRateLimiting(rlData)
if err != nil {
l.Debug("teams failed", zap.Error(err), zap.Any("rlData", rlData))
return nil, "", annotations, fmt.Errorf("baton-linear: failed to list teams: %w", err)
}

Expand All @@ -164,8 +166,10 @@ func (ln *Linear) ListTicketSchemas(ctx context.Context, p *pagination.Token) ([
return nil, "", annotations, err
}

fields, _, _, _, err := ln.client.ListIssueFields(ctx)
fields, _, _, rlData, err := ln.client.ListIssueFields(ctx)
annotations.WithRateLimiting(rlData)
if err != nil {
l.Debug("fields failed", zap.Error(err), zap.Any("rlData", rlData))
return nil, "", annotations, fmt.Errorf("baton-linear: failed to list issue fields: %w", err)
}

Expand Down
13 changes: 12 additions & 1 deletion pkg/linear/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -971,9 +971,20 @@ func (c *Client) doRequest(ctx context.Context, body interface{}, res interface{
}

resp, err := c.httpClient.Do(req, doOptions...)

l := ctxzap.Extract(ctx)
// Linear returns 400 when rate limited, so change it to a retryable error
if err != nil && resp != nil && resp.StatusCode == http.StatusBadRequest {
if err != nil && resp != nil && (resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusTooManyRequests) {
l.Debug("rate limiting detected", zap.Int("status_code", resp.StatusCode))

rlData.Status = v2.RateLimitDescription_STATUS_OVERLIMIT
return resp, rlData, uhttp.WrapErrorsWithRateLimitInfo(codes.Unavailable, resp, err)
}

if resp != nil {
l.Debug("returning without rate limit wrapping", zap.Int("status_code", resp.StatusCode))
} else {
l.Debug("returning without rate limit wrapping", zap.String("status_code", "nil response"))
}
return resp, rlData, err
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ github.com/benbjohnson/clock
# github.com/cenkalti/backoff/v4 v4.3.0
## explicit; go 1.18
github.com/cenkalti/backoff/v4
# github.com/conductorone/baton-sdk v0.3.28
# github.com/conductorone/baton-sdk v0.3.29
## explicit; go 1.23.4
github.com/conductorone/baton-sdk/internal/connector
github.com/conductorone/baton-sdk/pb/c1/c1z/v1
Expand Down
Loading