ClickHouse/src/Interpreters/DNSCacheUpdater.h
Ivan 495c6e03aa
Replace all Context references with std::weak_ptr (#22297)
* Replace all Context references with std::weak_ptr

* Fix shared context captured by value

* Fix build

* Fix Context with named sessions

* Fix copy context

* Fix gcc build

* Merge with master and fix build

* Fix gcc-9 build
2021-04-11 02:33:54 +03:00

30 lines
560 B
C++

#pragma once
#include <Core/BackgroundSchedulePool.h>
#include <Interpreters/Context_fwd.h>
#include <Common/Stopwatch.h>
namespace DB
{
/// Add a task to BackgroundProcessingPool that resolves all hosts and updates cache with constant period.
class DNSCacheUpdater : WithContext
{
public:
DNSCacheUpdater(ContextPtr context, Int32 update_period_seconds_);
~DNSCacheUpdater();
void start();
private:
void run();
Int32 update_period_seconds;
BackgroundSchedulePool & pool;
BackgroundSchedulePoolTaskHolder task_handle;
};
}