**How to reproduce**
```
for i in {1..1000}; do echo 'Hello, world!' | clickhouse-local --query "SELECT * FROM table" --structure 's String' | wc -c; done
```

This script hangs.
{
                    auto t = delayed_tasks.begin();
                    min_time = t->first;
                    task = t->second;
                }
                if (!task)
                {
                    wakeup_cond.wait(lock);
                    continue;
                }
                Poco::Timestamp current_time;
                if (min_time > current_time)
                {
                    wakeup_cond.wait_for(lock, std::chrono::microseconds(min_time - current_time));
                    continue;
                }
                else
                {
                    
                    found = true;
                    break;
                }
            }
        }
        if (found)
            task->schedule();
    }
}
}