bool BaseThriftServer::getTaskExpireTimeForRequest( const apache::thrift::transport::THeader& requestHeader, std::chrono::milliseconds& queueTimeout, std::chrono::milliseconds& taskTimeout) const { return getTaskExpireTimeForRequest( requestHeader.getClientQueueTimeout(), requestHeader.getClientTimeout(), queueTimeout, taskTimeout); }
bool BaseThriftServer::getTaskExpireTimeForRequest( const apache::thrift::transport::THeader& requestHeader, std::chrono::milliseconds& softTimeout, std::chrono::milliseconds& hardTimeout) const { softTimeout = getTaskExpireTime(); if (softTimeout == std::chrono::milliseconds(0)) { hardTimeout = softTimeout; return false; } if (getUseClientTimeout()) { // we add 10% to the client timeout so that the request is much more likely // to timeout on the client side than to read the timeout from the server // as a TApplicationException (which can be confusing) hardTimeout = std::chrono::milliseconds( (uint32_t)(requestHeader.getClientTimeout().count() * 1.1)); if (hardTimeout > std::chrono::milliseconds(0)) { if (hardTimeout < softTimeout || softTimeout == std::chrono::milliseconds(0)) { softTimeout = hardTimeout; return false; } else { return true; } } } hardTimeout = softTimeout; return false; }