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>
|
2021-04-10 23:33:54 +00:00
|
|
|
#include <Interpreters/Context_fwd.h>
|
2018-03-26 14:12:07 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2019-06-27 16:28:26 +00:00
|
|
|
/// Add a task to BackgroundProcessingPool that resolves all hosts and updates cache with constant period.
|
2021-04-10 23:33:54 +00:00
|
|
|
class DNSCacheUpdater : WithContext
|
2018-03-26 14:12:07 +00:00
|
|
|
{
|
|
|
|
public:
|
2022-04-05 11:00:14 +00:00
|
|
|
DNSCacheUpdater(ContextPtr context, Int32 update_period_seconds_, UInt32 max_consecutive_failures);
|
2019-06-27 16:28:26 +00:00
|
|
|
~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
|
|
|
|
2019-06-27 16:28:26 +00:00
|
|
|
Int32 update_period_seconds;
|
2022-04-05 11:00:14 +00:00
|
|
|
UInt32 max_consecutive_failures;
|
2019-06-27 16:28:26 +00:00
|
|
|
|
2019-04-06 01:09:15 +00:00
|
|
|
BackgroundSchedulePool & pool;
|
|
|
|
BackgroundSchedulePoolTaskHolder task_handle;
|
2018-03-26 14:12:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
}
|