Allow HHWheelTimer to set default-timeout
Summary: We are using facebook::proxygen to build Http-utility on top of it. One of the main server-connector class `Proxygen::HTTPConnector` requires `folly::HHWheelTimer` to perform timer stuff inside it. Now, `folly::HHWheelTimer` is a very large object and we would like to avoid `folly::HHWheelTimer` creation for every new `Proxygen::HTTPConnector` therefore, we are thinking to reuse `EventBase::timer()` that creates one timer per EventBase (application creates it 1 per io thread). But `EventBase::timer()` creates timer with default-time and caller can not modify it. Because of that other dependent component can't use it and proxygen gives below error: ``` F0522 23:50:19.629158 7775 WheelTimerInstance.cpp:71] Check failed: defaultTimeoutMS_.count() >= 0 (-1 vs. 0) *** Check failure stack trace: *** @ 0x7f5e6ce26e6d (unknown) @ 0x7f5e6ce28ced (unknown) @ 0x7f5e6ce26a5c (unknown) @ 0x7f5e6ce2963e (unknown) @ 0x7f5e6de8c1ad proxygen::WheelTimerInstance::scheduleTimeout() @ 0x7f5e6de7c059 proxygen::HTTPTransaction::HTTPTransaction() @ 0x7f5e6deacff1 ... @ 0x7f5e6deaa23a proxygen::HTTPSession::createTransaction() @ 0x4f7f93 proxygen::HTTPUpstreamSession::newTransaction() @ 0x4ad9a4 Sherpa::HttpSession::sendRequest() @ 0x4aee08 Sherpa::HttpSession::connectSuccess() @ 0x4f5c69 proxygen::HTTPConnector::connectSuccess() @ 0x7f5e6d47e414 folly::AsyncSocket::handleConnect() @ 0x7f5e6d48769d folly::AsyncSocket::handleWrite() @ 0x7f5e6d47a05c folly::AsyncSocket::ioReady() ``` - add `setDefaultTimeout()` method into timer so, application can configure it. - No functional change but it facilitates application to configure defaultTimeout after `folly::HHWheelTimer` is created. Closes https://github.com/facebook/folly/pull/850 Reviewed By: djwatson Differential Revision: D8123617 Pulled By: yfeldblum fbshipit-source-id: 4dd9b19506bea380239200b6207ac05a40a0686c
Showing
Please register or sign in to comment