2020-10-10 18:37:02 +00:00
|
|
|
#pragma once
|
2018-03-26 14:12:07 +00:00
|
|
|
|
2019-04-06 01:09:15 +00:00
|
|
|
#include <Core/BackgroundSchedulePool.h>
|
2019-06-27 16:28:26 +00:00
|
|
|
#include <Common/Stopwatch.h>
|
2019-04-06 01:09:15 +00:00
|
|
|
|
2018-03-26 14:12:07 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
class Context;
|
|
|
|
|
2019-06-27 16:28:26 +00:00
|
|
|
/// Add a task to BackgroundProcessingPool that resolves all hosts and updates cache with constant period.
|
2018-03-26 14:12:07 +00:00
|
|
|
class DNSCacheUpdater
|
|
|
|
{
|
|
|
|
public:
|
2019-06-27 16:28:26 +00:00
|
|
|
explicit DNSCacheUpdater(Context & context, Int32 update_period_seconds_);
|
|
|
|
~DNSCacheUpdater();
|
|
|
|
void start();
|
2018-03-26 14:12:07 +00:00
|
|
|
|
|
|
|
private:
|
2019-04-06 01:09:15 +00:00
|
|
|
void run();
|
2018-03-26 14:12:07 +00:00
|
|
|
|
|
|
|
Context & context;
|
2019-06-27 16:28:26 +00:00
|
|
|
Int32 update_period_seconds;
|
|
|
|
|
2019-04-06 01:09:15 +00:00
|
|
|
BackgroundSchedulePool & pool;
|
|
|
|
BackgroundSchedulePoolTaskHolder task_handle;
|
2018-03-26 14:12:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
}
|