Skip to content

Commit

Permalink
mitigating known issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavel Smejkal committed Dec 7, 2018
1 parent cd780c6 commit 2aa67cd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
22 changes: 13 additions & 9 deletions 2017-07-29/azqueue/url_messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
10 changes: 5 additions & 5 deletions 2017-07-29/azqueue/zc_pipeline.go
Original file line number Diff line number Diff line change
@@ -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"
)
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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) {
Expand All @@ -92,4 +92,4 @@ func newDefaultHTTPClientFactory() pipeline.Factory {
return pipeline.NewHTTPResponse(r), err
}
})
}
}

0 comments on commit 2aa67cd

Please sign in to comment.