diff --git a/td/telegram/SequenceDispatcher.cpp b/td/telegram/SequenceDispatcher.cpp index a54443d9c..cfc92e9df 100644 --- a/td/telegram/SequenceDispatcher.cpp +++ b/td/telegram/SequenceDispatcher.cpp @@ -314,7 +314,7 @@ class MultiSequenceDispatcherNewImpl final : public MultiSequenceDispatcherNew { bool check_timeout(TaskId task_id) { auto &node = *scheduler_.get_task_extra(task_id); NetQueryPtr &net_query = node.net_query; - if (net_query->is_ready()) { + if (net_query.empty() || net_query->is_ready()) { return false; } net_query->total_timeout_ += node.total_timeout; @@ -340,9 +340,9 @@ class MultiSequenceDispatcherNewImpl final : public MultiSequenceDispatcherNew { auto tl_constructor = query->tl_constructor(); scheduler_.for_each_dependent(task_id, [&](TaskId child_task_id) { auto &child_node = *scheduler_.get_task_extra(child_task_id); - if (node.net_query_ref->tl_constructor() == tl_constructor) { - node.total_timeout += query->last_timeout_; - node.last_timeout = query->last_timeout_; + if (child_node.net_query_ref->tl_constructor() == tl_constructor) { + child_node.total_timeout += query->last_timeout_; + child_node.last_timeout = query->last_timeout_; to_check_timeout.push_back(child_task_id); } }); diff --git a/td/telegram/SequenceDispatcher.h b/td/telegram/SequenceDispatcher.h index c5dafca73..5785d15fa 100644 --- a/td/telegram/SequenceDispatcher.h +++ b/td/telegram/SequenceDispatcher.h @@ -100,6 +100,6 @@ class MultiSequenceDispatcherNew : public NetQueryCallback { static ActorOwn create(Slice name); }; -using MultiSequenceDispatcher = MultiSequenceDispatcherOld; +using MultiSequenceDispatcher = MultiSequenceDispatcherNew; } // namespace td diff --git a/tdutils/td/utils/ChainScheduler.h b/tdutils/td/utils/ChainScheduler.h index 4e468fe97..2f2808767 100644 --- a/tdutils/td/utils/ChainScheduler.h +++ b/tdutils/td/utils/ChainScheduler.h @@ -17,6 +17,7 @@ #include #include +#include namespace td { @@ -342,6 +343,7 @@ void ChainScheduler::pause_task(TaskId task_id) { CHECK(task); inactivate_task(task_id, true); task->state = Task::State::Paused; + flush_try_start_task(); } template