Merge pull request #23836 from kitaisreal/xdbc-bridge-helper-use-global-context

XDBCBridgeHelper use global context
This commit is contained in:
Maksim Kita 2021-05-01 21:29:30 +03:00 committed by GitHub
commit b2b9c3950f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 6 deletions

View File

@ -24,11 +24,11 @@ LibraryBridgeHelper::LibraryBridgeHelper(
ContextPtr context_, ContextPtr context_,
const Block & sample_block_, const Block & sample_block_,
const Field & dictionary_id_) const Field & dictionary_id_)
: IBridgeHelper(context_) : IBridgeHelper(context_->getGlobalContext())
, log(&Poco::Logger::get("LibraryBridgeHelper")) , log(&Poco::Logger::get("LibraryBridgeHelper"))
, sample_block(sample_block_) , sample_block(sample_block_)
, config(context_->getConfigRef()) , config(context_->getConfigRef())
, http_timeout(context_->getSettingsRef().http_receive_timeout.value) , http_timeout(context_->getGlobalContext()->getSettingsRef().http_receive_timeout.value)
, dictionary_id(dictionary_id_) , dictionary_id(dictionary_id_)
{ {
bridge_port = config.getUInt("library_bridge.port", DEFAULT_PORT); bridge_port = config.getUInt("library_bridge.port", DEFAULT_PORT);

View File

@ -62,20 +62,19 @@ public:
static constexpr inline auto SCHEMA_ALLOWED_HANDLER = "/schema_allowed"; static constexpr inline auto SCHEMA_ALLOWED_HANDLER = "/schema_allowed";
XDBCBridgeHelper( XDBCBridgeHelper(
ContextPtr global_context_, ContextPtr context_,
Poco::Timespan http_timeout_, Poco::Timespan http_timeout_,
const std::string & connection_string_) const std::string & connection_string_)
: IXDBCBridgeHelper(global_context_) : IXDBCBridgeHelper(context_->getGlobalContext())
, log(&Poco::Logger::get(BridgeHelperMixin::getName() + "BridgeHelper")) , log(&Poco::Logger::get(BridgeHelperMixin::getName() + "BridgeHelper"))
, connection_string(connection_string_) , connection_string(connection_string_)
, http_timeout(http_timeout_) , http_timeout(http_timeout_)
, config(global_context_->getConfigRef()) , config(context_->getGlobalContext()->getConfigRef())
{ {
bridge_host = config.getString(BridgeHelperMixin::configPrefix() + ".host", DEFAULT_HOST); bridge_host = config.getString(BridgeHelperMixin::configPrefix() + ".host", DEFAULT_HOST);
bridge_port = config.getUInt(BridgeHelperMixin::configPrefix() + ".port", DEFAULT_PORT); bridge_port = config.getUInt(BridgeHelperMixin::configPrefix() + ".port", DEFAULT_PORT);
} }
protected: protected:
auto getConnectionString() const { return connection_string; } auto getConnectionString() const { return connection_string; }