From 2aa67cd1fc84045625c97dac01f3552127eeb6e9 Mon Sep 17 00:00:00 2001 From: Pavel Smejkal Date: Fri, 7 Dec 2018 17:10:40 +0100 Subject: [PATCH] mitigating known issues --- 2017-07-29/azqueue/url_messages.go | 22 +++++++++++++--------- 2017-07-29/azqueue/zc_pipeline.go | 10 +++++----- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/2017-07-29/azqueue/url_messages.go b/2017-07-29/azqueue/url_messages.go index 47cf4a0..b1b3be7 100644 --- a/2017-07-29/azqueue/url_messages.go +++ b/2017-07-29/azqueue/url_messages.go @@ -5,8 +5,9 @@ import ( "net/url" "time" - "github.com/Azure/azure-pipeline-go/pipeline" "net/http" + + "github.com/Azure/azure-pipeline-go/pipeline" ) // MessageID represents a Message ID as a string. @@ -79,23 +80,26 @@ func (m MessagesURL) Enqueue(ctx context.Context, messageText string, visibility vt := int32(visibilityTimeout.Seconds()) ttl := int32(timeToLive.Seconds()) er, err := m.client.Enqueue(ctx, QueueMessage{MessageText: messageText}, &vt, &ttl, nil, nil) + if err != nil { + return nil, err + } item := er.Items[0] return &EnqueueMessageResponse{ - inner: er, - MessageID:MessageID(item.MessageID), - PopReceipt:PopReceipt(item.PopReceipt), - TimeNextVisible:item.TimeNextVisible, - InsertionTime:item.InsertionTime, - ExpirationTime:item.ExpirationTime, + inner: er, + MessageID: MessageID(item.MessageID), + PopReceipt: PopReceipt(item.PopReceipt), + TimeNextVisible: item.TimeNextVisible, + InsertionTime: item.InsertionTime, + ExpirationTime: item.ExpirationTime, }, err } // EnqueueMessageResponse holds the results of a successfully-enqueued message. type EnqueueMessageResponse struct { - inner *EnqueueResponse + inner *EnqueueResponse // MessageID returns the service-assigned ID for the enqueued message. - MessageID MessageID + MessageID MessageID // PopReceipt returns the service-assigned PopReceipt for the enqueued message. // You could use this to create a MessageIDURL object. diff --git a/2017-07-29/azqueue/zc_pipeline.go b/2017-07-29/azqueue/zc_pipeline.go index 3429ffa..f099b23 100644 --- a/2017-07-29/azqueue/zc_pipeline.go +++ b/2017-07-29/azqueue/zc_pipeline.go @@ -1,11 +1,12 @@ package azqueue import ( - "github.com/Azure/azure-pipeline-go/pipeline" "context" - "net/http" "net" + "net/http" "time" + + "github.com/Azure/azure-pipeline-go/pipeline" //"net/url" //"log" ) @@ -48,7 +49,7 @@ func NewPipeline(c Credential, o PipelineOptions) pipeline.Pipeline { pipeline.MethodFactoryMarker(), // indicates at what stage in the pipeline the method factory is invoked NewRequestLogPolicyFactory(o.RequestLog)) - return pipeline.NewPipeline(f, pipeline.Options{HTTPSender: newDefaultHTTPClientFactory(), Log: o.Log}) + return pipeline.NewPipeline(f, pipeline.Options{HTTPSender: nil, Log: o.Log}) } func newDefaultHTTPClient() *http.Client { @@ -81,7 +82,6 @@ func newDefaultHTTPClient() *http.Client { } } - func newDefaultHTTPClientFactory() pipeline.Factory { return pipeline.FactoryFunc(func(next pipeline.Policy, po *pipeline.PolicyOptions) pipeline.PolicyFunc { return func(ctx context.Context, request pipeline.Request) (pipeline.Response, error) { @@ -92,4 +92,4 @@ func newDefaultHTTPClientFactory() pipeline.Factory { return pipeline.NewHTTPResponse(r), err } }) -} \ No newline at end of file +}