dustin/go-couchbase — pull request #3 by mendsley (2013-08-23 18:43:15+00:00)
Title: TAP connections no longer drain connection pool

TAP event connections to the couchbase server cannot be reused once they
are exhausted, and are therefore closed when complete. Because these
connections are pulled from the connection pool but are never returned,
an application making periodic TAP streams will eventually exhaust the
connection pool, indefinately blocking the app (by 720h by default).

Capacity of the connection pool is managed by a buffered channel which
acts as a semaphore. Sending on the channel acquires the samephore,
receiving releases it.

To allow TAP connections that do not count against the connection pool
capacity, we simply release the semaphore when creating the stream.