Skip to content

Commit

Permalink
make it compile
Browse files Browse the repository at this point in the history
  • Loading branch information
zengmin-wish committed Jul 8, 2019
1 parent 164f2af commit 001b5d0
Showing 1 changed file with 12 additions and 33 deletions.
45 changes: 12 additions & 33 deletions backends/sqs/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
type Backend struct {
// TODO: LRU Cache?
nameMapping *sync.Map
sqs *sqs.SQS
sqs *sqs.Client

m metrics.QProxyMetrics
// Perf optimization
Expand Down Expand Up @@ -137,9 +137,7 @@ func (s *Backend) GetQueueUrl(ctx context.Context, in *rpc.QueueId) (string, err
QueueName: QueueIdToName(in),
})

req.SetContext(ctx)

resp, err := req.Send()
resp, err := req.Send(ctx)
if err != nil {
return "", err
}
Expand All @@ -162,12 +160,11 @@ func (s *Backend) ListQueues(in *rpc.ListQueuesRequest, stream rpc.QProxy_ListQu
})

ctx := stream.Context()
req.SetContext(ctx)

// TODO: The ListQueues API has a 1000 object return limit, and no paging functionality
// so we'll either need to do some extra work here to get _all_ results or add
// a field to the response indicating that it was truncated
resp, err := req.Send()
resp, err := req.Send(ctx)
if err != nil {
return err
}
Expand Down Expand Up @@ -212,9 +209,7 @@ func (s *Backend) GetQueue(ctx context.Context, in *rpc.GetQueueRequest) (*rpc.G
AttributeNames: []sqs.QueueAttributeName{sqs.QueueAttributeNameAll},
})

req.SetContext(ctx)

resp, err := req.Send()
resp, err := req.Send(ctx)
if err != nil {
return nil, err
}
Expand All @@ -229,9 +224,7 @@ func (s *Backend) CreateQueue(ctx context.Context, in *rpc.CreateQueueRequest) (
Attributes: in.Attributes,
})

req.SetContext(ctx)

resp, err := req.Send()
resp, err := req.Send(ctx)
if err != nil {
return nil, err
}
Expand All @@ -250,9 +243,7 @@ func (s *Backend) DeleteQueue(ctx context.Context, in *rpc.DeleteQueueRequest) (
QueueUrl: &url,
})

req.SetContext(ctx)

_, err = req.Send()
_, err = req.Send(ctx)
if err != nil {
return nil, err
}
Expand All @@ -271,9 +262,7 @@ func (s *Backend) ModifyQueue(ctx context.Context, in *rpc.ModifyQueueRequest) (
Attributes: in.Attributes,
})

req.SetContext(ctx)

_, err = req.Send()
_, err = req.Send(ctx)
if err != nil {
return nil, err
}
Expand All @@ -291,9 +280,7 @@ func (s *Backend) PurgeQueue(ctx context.Context, in *rpc.PurgeQueueRequest) (*r
QueueUrl: &url,
})

req.SetContext(ctx)

_, err = req.Send()
_, err = req.Send(ctx)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -321,9 +308,7 @@ func (s *Backend) AckMessages(ctx context.Context, in *rpc.AckMessagesRequest) (
Entries: entries,
})

req.SetContext(ctx)

resp, err := req.Send()
resp, err := req.Send(ctx)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -351,9 +336,7 @@ func (s *Backend) GetMessages(ctx context.Context, in *rpc.GetMessagesRequest) (
VisibilityTimeout: &in.AckDeadlineSeconds,
})

req.SetContext(ctx)

resp, err := req.Send()
resp, err := req.Send(ctx)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -406,9 +389,7 @@ func (s *Backend) PublishMessages(ctx context.Context, in *rpc.PublishMessagesRe
Entries: entries,
})

req.SetContext(ctx)

resp, err := req.Send()
resp, err := req.Send(ctx)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -439,9 +420,7 @@ func (s *Backend) ModifyAckDeadline(ctx context.Context, in *rpc.ModifyAckDeadli
VisibilityTimeout: &in.AckDeadlineSeconds,
})

req.SetContext(ctx)

_, err = req.Send()
_, err = req.Send(ctx)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 001b5d0

Please sign in to comment.