diff --git a/telegram-bot-api/Query.h b/telegram-bot-api/Query.h index 8d79aba..66c8e55 100644 --- a/telegram-bot-api/Query.h +++ b/telegram-bot-api/Query.h @@ -114,6 +114,8 @@ class Query final : public td::ListNode { if (!empty()) { shared_data_->query_list_size_.fetch_sub(1, std::memory_order_relaxed); } + td::Scheduler::instance()->destroy_on_scheduler(SharedData::get_file_gc_scheduler_id(), container_, args_, + headers_, files_, answer_); } } diff --git a/telegram-bot-api/WebhookActor.cpp b/telegram-bot-api/WebhookActor.cpp index 318390c..e21e114 100644 --- a/telegram-bot-api/WebhookActor.cpp +++ b/telegram-bot-api/WebhookActor.cpp @@ -590,6 +590,11 @@ void WebhookActor::send_updates() { } void WebhookActor::handle(td::unique_ptr response) { + SCOPE_EXIT { + bool dummy = false; + td::Scheduler::instance()->destroy_on_scheduler(SharedData::get_file_gc_scheduler_id(), response, dummy); + }; + auto connection_id = get_link_token(); if (response) { VLOG(webhook) << "Got response from connection " << connection_id;