bpot/poseidon — pull request #54 by zachmargolis (2014-08-01 06:58:02+00:00)
Title: Clean up connections inside of consumer_for_partition

I believe there were a few places connections can get leaked when building consumers. In our test suite, I ended up running out of file descriptors a few times.

Also would it make sense to add a methods that use blocks? Then we can auto-cleanup after each block and make it easier to not leak connections? It would turn some of these changes into this:

```ruby
broker = BrokerPool.with_pool(client_id, seed_brokers) do |broker_pool|
cluster_metadata = ClusterMetadata.new
cluster_metadata.update(broker_pool.fetch_metadata([topic]))
cluster_metadata.lead_broker_for_partition(topic, partition)
end
```

or

```ruby
Connection.with_connection(host, port, client_id) do |connection|
connection.topic_metadata(topics)
end
```