Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow invoking callbacks from HTTPConnector.reset() and enable them i…
…n ConnectionHelper destructor to track cancellations Summary: HTTPConnector intentionally avoids invoking the callbacks when reset() is called. I found D1142299, which added the logic, presumably, to enable reusing the HTTPConnector for the next health check, without invoking the callbacks on cancellation of the outstanding connection attempts. I don't think this particular code path needs it anymore, but some of the other consumers came to rely on the fact that callbacks are not invoked on reset(). In the rev proxy, reset() [ is explicitly called from the ConnectionHelper](https://www.internalfb.com/code/fbsource/[95a94eb3ce59841ad2a5d9f88727b57d600e21ab]/fbcode/proxygen/facebook/revproxy/ConnectionHelper.cpp?lines=52-610) during its destruction to cancel any pending requests, not to reuse the connector. I need the callbacks to be invoked when this happens to account for the cancelation in the metric that I am adding. An easy way of doing it is to provide a flag, defaulting to the existing behavior, to enable the callbacks. Splitting out this small change to narrow down the blast radius and test it separately. A potential alternative solution would be to add a new onCanceled() callback and call that one unconditionally on cancellation. I can do this more invasive change if something doesn't work out with this one. Reviewed By: afrind Differential Revision: D61172051 fbshipit-source-id: 7d69e3efa5f0cbace54c3822cca8610d826a77a6
- Loading branch information