mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-15 19:02:04 +00:00
Update src/Storages/PostgreSQL/PostgreSQLReplicationHandler.cpp
Co-authored-by: tavplubix <tavplubix@gmail.com>
This commit is contained in:
parent
6bb81630e5
commit
4e63b8e5dd
@ -217,26 +217,19 @@ NameSet PostgreSQLReplicationHandler::loadFromSnapshot(std::string & snapshot_na
|
||||
|
||||
void PostgreSQLReplicationHandler::consumerFunc()
|
||||
{
|
||||
auto start_time = std::chrono::steady_clock::now();
|
||||
std::vector<std::pair<Int32, String>> skipped_tables;
|
||||
|
||||
while (!stop_synchronization)
|
||||
{
|
||||
bool reschedule = !consumer->consume(skipped_tables);
|
||||
bool schedule_now = consumer->consume(skipped_tables);
|
||||
|
||||
if (!skipped_tables.empty())
|
||||
consumer->updateSkipList(reloadFromSnapshot(skipped_tables));
|
||||
|
||||
if (reschedule)
|
||||
break;
|
||||
if (stop_synchronization)
|
||||
return;
|
||||
|
||||
auto end_time = std::chrono::steady_clock::now();
|
||||
auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(end_time - start_time);
|
||||
if (duration.count() > max_thread_work_duration_ms)
|
||||
break;
|
||||
}
|
||||
|
||||
if (!stop_synchronization)
|
||||
if (schedule_now)
|
||||
consumer_task->schedule();
|
||||
else
|
||||
consumer_task->scheduleAfter(reschedule_ms);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user