Skip to content
This repository has been archived by the owner on Feb 7, 2024. It is now read-only.

Commit

Permalink
Merge pull request #53 from scroot/master
Browse files Browse the repository at this point in the history
pubsub/pub TCP未关闭
  • Loading branch information
whyrusleeping committed Jul 3, 2017
2 parents e577e10 + 0666f00 commit 2da86eb
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions shell.go
Original file line number Diff line number Diff line change
Expand Up @@ -737,11 +737,17 @@ func (s *Shell) PubSubSubscribe(topic string) (*PubSubSubscription, error) {
return newPubSubSubscription(resp), nil
}

func (s *Shell) PubSubPublish(topic, data string) error {
_, err := s.newRequest(context.Background(), "pubsub/pub", topic, data).Send(s.httpcli)
func (s *Shell) PubSubPublish(topic, data string) (err error) {
resp, err := s.newRequest(context.Background(), "pubsub/pub", topic, data).Send(s.httpcli)
if err != nil {
return err
return
}
defer func(){
err1 := resp.Close()
if err == nil {
err = err1
}
}()

return nil
}
Expand Down

0 comments on commit 2da86eb

Please sign in to comment.