Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up linting warnings #4290

Merged
merged 10 commits into from
Jul 7, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
12 changes: 0 additions & 12 deletions client/matching/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,15 +307,3 @@ func (c *clientImpl) getClientForTaskList(key string) (Client, error) {
}
return client.(Client), nil
}

func (c *clientImpl) getTaskListsByDomain(
cl Client,
ctx context.Context,
request *types.GetTaskListsByDomainRequest,
opts ...yarpc.CallOption,
) (*types.GetTaskListsByDomainResponse, error) {
ctx, cancel := c.createContext(ctx)
defer cancel()

return cl.GetTaskListsByDomain(ctx, request, opts...)
}
4 changes: 3 additions & 1 deletion common/metrics/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ package metrics

import "context"

const contextTagsKey = "metrics.Tags"
type contextTag string

const contextTagsKey = contextTag("metrics.Tags")

func TagContext(ctx context.Context, tag Tag) context.Context {
tags, ok := ctx.Value(contextTagsKey).([]Tag)
Expand Down
2 changes: 1 addition & 1 deletion common/persistence/nosql/nosqlTaskStore.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func (t *nosqlTaskStore) LeaseTaskList(
}

// Update the rangeID as this is an ownership change
currTL.RangeID += 1
currTL.RangeID++

err = t.db.UpdateTaskList(ctx, &nosqlplugin.TaskListRow{
DomainID: request.DomainID,
Expand Down
22 changes: 6 additions & 16 deletions common/persistence/sql/sqlExecutionStoreUtil.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,18 +188,15 @@ func applyWorkflowMutationTx(
}
}

if err := updateBufferedEvents(
return updateBufferedEvents(
ctx,
tx,
workflowMutation.NewBufferedEvents,
shardID,
domainID,
workflowID,
runID,
); err != nil {
return err
}
return nil
)
}

func applyWorkflowSnapshotTxAsReset(
Expand Down Expand Up @@ -395,16 +392,13 @@ func applyWorkflowSnapshotTxAsReset(
return err
}

if err := deleteBufferedEvents(
return deleteBufferedEvents(
ctx,
tx,
shardID,
domainID,
workflowID,
runID); err != nil {
return err
}
return nil
runID)
}

func (m *sqlExecutionStore) applyWorkflowSnapshotTxAsNew(
Expand Down Expand Up @@ -516,19 +510,15 @@ func (m *sqlExecutionStore) applyWorkflowSnapshotTxAsNew(
return err
}

if err := updateSignalsRequested(
return updateSignalsRequested(
ctx,
tx,
workflowSnapshot.SignalRequestedIDs,
nil,
shardID,
domainID,
workflowID,
runID); err != nil {
return err
}

return nil
runID)
}

func applyTasks(
Expand Down
6 changes: 3 additions & 3 deletions common/persistence/sql/sqlplugin/postgres/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,21 +62,21 @@ func (pdb *db) IsDupEntryError(err error) bool {
return ok && sqlErr.Code == ErrDupEntry
}

func (mdb *db) IsNotFoundError(err error) bool {
func (pdb *db) IsNotFoundError(err error) bool {
if err == sql.ErrNoRows {
return true
}
return false
}

func (mdb *db) IsTimeoutError(err error) bool {
func (pdb *db) IsTimeoutError(err error) bool {
if err == context.DeadlineExceeded {
return true
}
return false
}

func (mdb *db) IsThrottlingError(err error) bool {
func (pdb *db) IsThrottlingError(err error) bool {
sqlErr, ok := err.(*pq.Error)
if ok {
if sqlErr.Code == ErrTooManyConnections ||
Expand Down
5 changes: 2 additions & 3 deletions common/persistence/visibilitySamplingClient.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,10 +318,9 @@ func (p *visibilitySamplingClient) tryConsumeListToken(domain string) error {
if ok {
p.logger.Debug("List API request consumed QPS token", tag.WorkflowDomainName(domain), tag.Name(callerFuncName(2)))
return nil
} else {
p.logger.Debug("List API request is being sampled", tag.WorkflowDomainName(domain), tag.Name(callerFuncName(2)))
return errPersistenceLimitExceededForList
}
p.logger.Debug("List API request is being sampled", tag.WorkflowDomainName(domain), tag.Name(callerFuncName(2)))
return errPersistenceLimitExceededForList
}

func callerFuncName(skip int) string {
Expand Down
10 changes: 10 additions & 0 deletions common/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -900,3 +900,13 @@ func MicrosecondsToDuration(d int64) time.Duration {
func NanosecondsToDuration(d int64) time.Duration {
return time.Duration(d) * time.Nanosecond
}

// SleepWithMinDuration sleeps for the minimum of desired and available duration
// returns the remaining available time duration
func SleepWithMinDuration(desired time.Duration, available time.Duration) time.Duration {
d := MinDuration(desired, available)
if d > 0 {
time.Sleep(d)
}
return available - d
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading