uber / tchannel-node

MIT License
203 stars 40 forks source link

ensure that requests timeout even when initOp #343

Closed Raynos closed 7 years ago

Raynos commented 7 years ago

This improves the pre-flight waitForIdentified() logic in the tchannel.Request class.

Here we will actually do a check to see if we have a usable connection and skip the waiting.

If we have to wait because there are zero connections we also allocate a RequestOperation with a properly configured timeout and add it to the timeHeap.

This means that the request will timeout within it's specified timeout irregardless of what the connection initTimeout value is.

We clean up and cancel the timeout once a connection is identified and available

r: @zhijin @syyang

zhijinli commented 7 years ago

LGTM

syyang commented 7 years ago

lgtm. thanks!