Skip to content

Commit

Permalink
Skip ratelimiting for some persistence APIs (#3322)
Browse files Browse the repository at this point in the history
  • Loading branch information
yycptt authored Sep 7, 2022
1 parent dc328c7 commit 15cf869
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions common/persistence/persistenceRateLimitedClients.go
Original file line number Diff line number Diff line change
Expand Up @@ -653,9 +653,11 @@ func (p *executionRateLimitedPersistenceClient) ParseHistoryBranchInfo(
ctx context.Context,
request *ParseHistoryBranchInfoRequest,
) (*ParseHistoryBranchInfoResponse, error) {
if ok := allow(ctx, "ParseHistoryBranchInfo", p.rateLimiter); !ok {
return nil, ErrPersistenceLimitExceeded
}
// ParseHistoryBranchInfo implementation currently doesn't actually query DB
// TODO: uncomment if necessary
// if ok := allow(ctx, "ParseHistoryBranchInfo", p.rateLimiter); !ok {
// return nil, ErrPersistenceLimitExceeded
// }
return p.persistence.ParseHistoryBranchInfo(ctx, request)
}

Expand All @@ -664,9 +666,11 @@ func (p *executionRateLimitedPersistenceClient) UpdateHistoryBranchInfo(
ctx context.Context,
request *UpdateHistoryBranchInfoRequest,
) (*UpdateHistoryBranchInfoResponse, error) {
if ok := allow(ctx, "UpdateHistoryBranchInfo", p.rateLimiter); !ok {
return nil, ErrPersistenceLimitExceeded
}
// UpdateHistoryBranchInfo implementation currently doesn't actually query DB
// TODO: uncomment if necessary
// if ok := allow(ctx, "UpdateHistoryBranchInfo", p.rateLimiter); !ok {
// return nil, ErrPersistenceLimitExceeded
// }
return p.persistence.UpdateHistoryBranchInfo(ctx, request)
}

Expand All @@ -675,11 +679,12 @@ func (p *executionRateLimitedPersistenceClient) NewHistoryBranch(
ctx context.Context,
request *NewHistoryBranchRequest,
) (*NewHistoryBranchResponse, error) {
if ok := allow(ctx, "NewHistoryBranch", p.rateLimiter); !ok {
return nil, ErrPersistenceLimitExceeded
}
response, err := p.persistence.NewHistoryBranch(ctx, request)
return response, err
// NewHistoryBranch implementation currently doesn't actually query DB
// TODO: uncomment if necessary
// if ok := allow(ctx, "NewHistoryBranch", p.rateLimiter); !ok {
// return nil, ErrPersistenceLimitExceeded
// }
return p.persistence.NewHistoryBranch(ctx, request)
}

// ReadHistoryBranch returns history node data for a branch
Expand Down

0 comments on commit 15cf869

Please sign in to comment.