diff --git a/Telegram/SourceFiles/data/data_channel.cpp b/Telegram/SourceFiles/data/data_channel.cpp index 23788160b0..52d37ef95f 100644 --- a/Telegram/SourceFiles/data/data_channel.cpp +++ b/Telegram/SourceFiles/data/data_channel.cpp @@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "api/api_credits.h" #include "api/api_global_privacy.h" #include "api/api_statistics.h" +#include "base/timer_rpl.h" #include "data/components/credits.h" #include "data/data_changes.h" #include "data/data_channel_admins.h" @@ -1360,6 +1361,7 @@ void ApplyChannelUpdate( } if (channel->flags() & Flag::CanViewRevenue) { + static constexpr auto kTimeout = crl::time(60000); const auto id = channel->id; const auto weak = base::make_weak(&channel->session()); const auto creditsLoadLifetime = std::make_shared(); @@ -1371,6 +1373,9 @@ void ApplyChannelUpdate( creditsLoadLifetime->destroy(); } }); + base::timer_once(kTimeout) | rpl::start_with_next([=] { + creditsLoadLifetime->destroy(); + }, *creditsLoadLifetime); const auto currencyLoadLifetime = std::make_shared(); const auto currencyLoad = currencyLoadLifetime->make_state(channel); @@ -1385,6 +1390,9 @@ void ApplyChannelUpdate( currencyLoadLifetime->destroy(); } }, *currencyLoadLifetime); + base::timer_once(kTimeout) | rpl::start_with_next([=] { + currencyLoadLifetime->destroy(); + }, *currencyLoadLifetime); } // For clearUpTill() call. diff --git a/Telegram/SourceFiles/data/data_user.cpp b/Telegram/SourceFiles/data/data_user.cpp index dcebbfca9b..1b0642ef92 100644 --- a/Telegram/SourceFiles/data/data_user.cpp +++ b/Telegram/SourceFiles/data/data_user.cpp @@ -11,6 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "api/api_global_privacy.h" #include "api/api_sensitive_content.h" #include "api/api_statistics.h" +#include "base/timer_rpl.h" #include "storage/localstorage.h" #include "storage/storage_account.h" #include "storage/storage_user_photos.h" @@ -767,6 +768,7 @@ void ApplyUserUpdate(not_null user, const MTPDuserFull &update) { Data::PeerUpdate::Flag::Rights); } if (info->canEditInformation) { + static constexpr auto kTimeout = crl::time(60000); const auto id = user->id; const auto weak = base::make_weak(&user->session()); const auto creditsLoadLifetime @@ -779,6 +781,9 @@ void ApplyUserUpdate(not_null user, const MTPDuserFull &update) { creditsLoadLifetime->destroy(); } }); + base::timer_once(kTimeout) | rpl::start_with_next([=] { + creditsLoadLifetime->destroy(); + }, *creditsLoadLifetime); const auto currencyLoadLifetime = std::make_shared(); const auto currencyLoad @@ -794,6 +799,9 @@ void ApplyUserUpdate(not_null user, const MTPDuserFull &update) { currencyLoadLifetime->destroy(); } }, *currencyLoadLifetime); + base::timer_once(kTimeout) | rpl::start_with_next([=] { + currencyLoadLifetime->destroy(); + }, *currencyLoadLifetime); } }