Skip to content

Commit

Permalink
remove lock of http request, it will lock loing polling
Browse files Browse the repository at this point in the history
  • Loading branch information
xujinzheng committed May 5, 2016
1 parent 5f5bf03 commit b5ab71a
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"net/http"
"net/url"
"strings"
"sync"
"time"

"github.com/gogap/errors"
Expand Down Expand Up @@ -46,13 +45,12 @@ type MNSClient interface {
}

type AliMNSClient struct {
Timeout int64
url string
credential Credential
accessKeyId string
clientLocker sync.Mutex
client *http.Client
proxyURL string
Timeout int64
url string
credential Credential
accessKeyId string
client *http.Client
proxyURL string
}

func NewAliMNSClient(url, accessKeyId, accessKeySecret string) MNSClient {
Expand Down Expand Up @@ -152,9 +150,6 @@ func (p *AliMNSClient) Send(method Method, headers map[string]string, message in

postBodyReader := strings.NewReader(string(xmlContent))

p.clientLocker.Lock()
defer p.clientLocker.Unlock()

var req *http.Request
if req, err = http.NewRequest(string(method), url, postBodyReader); err != nil {
err = ERR_CREATE_NEW_REQUEST_FAILED.New(errors.Params{"err": err})
Expand Down

0 comments on commit b5ab71a

Please sign in to comment.