mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 23:52:03 +00:00
This commit is contained in:
parent
99a19de80e
commit
b08463ed7b
@ -59,12 +59,7 @@ bool BackgroundSchedulePool::TaskInfo::schedule()
|
||||
|
||||
bool BackgroundSchedulePool::TaskInfo::scheduleAfter(size_t ms)
|
||||
{
|
||||
std::lock_guard lock(mutex);
|
||||
|
||||
if (deactivated || scheduled)
|
||||
return false;
|
||||
|
||||
pool.scheduleDelayedTask(shared_from_this(), ms, lock);
|
||||
pool.scheduleDelayedTask(shared_from_this(), ms);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -160,7 +155,7 @@ void BackgroundSchedulePool::removeTask(const TaskHandle & task)
|
||||
}
|
||||
|
||||
|
||||
void BackgroundSchedulePool::scheduleDelayedTask(const TaskHandle & task, size_t ms, std::lock_guard<std::recursive_mutex> &)
|
||||
void BackgroundSchedulePool::scheduleDelayedTask(const TaskHandle & task, size_t ms)
|
||||
{
|
||||
Poco::Timestamp current_time;
|
||||
|
||||
|
@ -90,7 +90,7 @@ private:
|
||||
void delayExecutionThreadFunction();
|
||||
|
||||
/// Schedule task for execution after specified delay from now.
|
||||
void scheduleDelayedTask(const TaskHandle & task, size_t ms, std::lock_guard<std::recursive_mutex> &);
|
||||
void scheduleDelayedTask(const TaskHandle & task, size_t ms);
|
||||
|
||||
/// Remove task, that was scheduled with delay, from schedule.
|
||||
void cancelDelayedTask(const TaskHandle & task, std::lock_guard<std::recursive_mutex> &);
|
||||
|
@ -206,7 +206,7 @@ WatchCallback ZooKeeper::callbackForTaskHandle(const TaskHandlePtr & task)
|
||||
{
|
||||
if (t)
|
||||
{
|
||||
t->schedule();
|
||||
t->scheduleAfter(0);
|
||||
t.reset(); /// The event is set only once, even if the callback can fire multiple times due to session events.
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user