Skip to content

Commit

Permalink
Merge pull request #114 from Azure/issue-111
Browse files Browse the repository at this point in the history
defer close tcp connection for mgmt calls
  • Loading branch information
devigned committed Jun 3, 2019
2 parents 95f9bc0 + 8f60b09 commit d3d1b70
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
3 changes: 3 additions & 0 deletions changelog.md
@@ -1,5 +1,8 @@
# Change Log

## `v1.3.1`
- cleanup connection after making management request

## `v1.3.0`
- add `SystemProperties` to `Event` which contains immutable broker provided metadata (squence number, offset,
enqueued time)
Expand Down
13 changes: 13 additions & 0 deletions hub.go
Expand Up @@ -493,6 +493,12 @@ func (h *Hub) GetRuntimeInformation(ctx context.Context) (*HubRuntimeInformation
return nil, err
}

defer func() {
if err := c.Close(); err != nil {
log.For(ctx).Error(err)
}
}()

info, err := client.GetHubRuntimeInformation(ctx, c)
if err != nil {
log.For(ctx).Error(err)
Expand All @@ -509,9 +515,16 @@ func (h *Hub) GetPartitionInformation(ctx context.Context, partitionID string) (
client := newClient(h.namespace, h.name)
c, err := h.namespace.newConnection()
if err != nil {
log.For(ctx).Error(err)
return nil, err
}

defer func() {
if err := c.Close(); err != nil {
log.For(ctx).Error(err)
}
}()

info, err := client.GetHubPartitionRuntimeInformation(ctx, c, partitionID)
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion version.go
Expand Up @@ -2,5 +2,5 @@ package eventhub

const (
// Version is the semantic version number
Version = "1.3.0"
Version = "1.3.1"
)

0 comments on commit d3d1b70

Please sign in to comment.