From 15cf869831cc6f075830895a7bb0325eae744576 Mon Sep 17 00:00:00 2001 From: Yichao Yang Date: Wed, 7 Sep 2022 13:47:44 -0700 Subject: [PATCH] Skip ratelimiting for some persistence APIs (#3322) --- .../persistenceRateLimitedClients.go | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/common/persistence/persistenceRateLimitedClients.go b/common/persistence/persistenceRateLimitedClients.go index 99fae67a6e4..167f33134cd 100644 --- a/common/persistence/persistenceRateLimitedClients.go +++ b/common/persistence/persistenceRateLimitedClients.go @@ -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) } @@ -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) } @@ -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