Simplify Manager actor reset.

This commit is contained in:
levlam 2024-01-13 02:08:28 +03:00
parent 916e5de43e
commit ffdb02374e
2 changed files with 62 additions and 114 deletions

View File

@ -347,7 +347,7 @@ function split_file($file, $chunks, $undo) {
'GlobalPrivacySettings' => 'GlobalPrivacySettings',
'GroupCallId' => 'GroupCallId',
'group_call_manager[_(-](?![.]get[(][)])|GroupCallManager' => 'GroupCallManager',
'HashtagHints' => 'HashtagHints',
'hashtag_hints[_(-](?![.]get[(][)])|HashtagHints' => 'HashtagHints',
'inline_queries_manager[_(-](?![.]get[(][)])|InlineQueriesManager' => 'InlineQueriesManager',
'language_pack_manager[_(-]|LanguagePackManager' => 'LanguagePackManager',
'link_manager[_(-](?![.]get[(][)])|LinkManager' => 'LinkManager',

View File

@ -3291,35 +3291,25 @@ void Td::clear() {
alarm_timeout_.cancel_timeout(PING_SERVER_ALARM_ID);
alarm_timeout_.cancel_timeout(TERMS_OF_SERVICE_ALARM_ID);
alarm_timeout_.cancel_timeout(PROMO_DATA_ALARM_ID);
LOG(DEBUG) << "Requests were answered" << timer;
auto reset_actor = [&timer](ActorOwn<Actor> actor) {
LOG(DEBUG) << "Start clearing " << actor.get().get_name() << timer;
};
// close all pure actors
call_manager_.reset();
LOG(DEBUG) << "CallManager was cleared" << timer;
change_phone_number_manager_.reset();
LOG(DEBUG) << "ChangePhoneNumberManager was cleared" << timer;
config_manager_.reset();
LOG(DEBUG) << "ConfigManager was cleared" << timer;
confirm_phone_number_manager_.reset();
LOG(DEBUG) << "ConfirmPhoneNumberManager was cleared" << timer;
device_token_manager_.reset();
LOG(DEBUG) << "DeviceTokenManager was cleared" << timer;
hashtag_hints_.reset();
LOG(DEBUG) << "HashtagHints was cleared" << timer;
language_pack_manager_.reset();
LOG(DEBUG) << "LanguagePackManager was cleared" << timer;
net_stats_manager_.reset();
LOG(DEBUG) << "NetStatsManager was cleared" << timer;
password_manager_.reset();
LOG(DEBUG) << "PasswordManager was cleared" << timer;
secure_manager_.reset();
LOG(DEBUG) << "SecureManager was cleared" << timer;
secret_chats_manager_.reset();
LOG(DEBUG) << "SecretChatsManager was cleared" << timer;
storage_manager_.reset();
LOG(DEBUG) << "StorageManager was cleared" << timer;
verify_phone_number_manager_.reset();
LOG(DEBUG) << "VerifyPhoneNumberManager was cleared" << timer;
reset_actor(ActorOwn<Actor>(std::move(call_manager_)));
reset_actor(ActorOwn<Actor>(std::move(change_phone_number_manager_)));
reset_actor(ActorOwn<Actor>(std::move(config_manager_)));
reset_actor(ActorOwn<Actor>(std::move(confirm_phone_number_manager_)));
reset_actor(ActorOwn<Actor>(std::move(device_token_manager_)));
reset_actor(ActorOwn<Actor>(std::move(hashtag_hints_)));
reset_actor(ActorOwn<Actor>(std::move(language_pack_manager_)));
reset_actor(ActorOwn<Actor>(std::move(net_stats_manager_)));
reset_actor(ActorOwn<Actor>(std::move(password_manager_)));
reset_actor(ActorOwn<Actor>(std::move(secure_manager_)));
reset_actor(ActorOwn<Actor>(std::move(secret_chats_manager_)));
reset_actor(ActorOwn<Actor>(std::move(storage_manager_)));
reset_actor(ActorOwn<Actor>(std::move(verify_phone_number_manager_)));
G()->set_connection_creator(ActorOwn<ConnectionCreator>());
LOG(DEBUG) << "ConnectionCreator was cleared" << timer;
@ -3327,92 +3317,50 @@ void Td::clear() {
LOG(DEBUG) << "TempAuthKeyWatchdog was cleared" << timer;
// clear actors which are unique pointers
account_manager_actor_.reset();
LOG(DEBUG) << "AccountManager actor was cleared" << timer;
animations_manager_actor_.reset();
LOG(DEBUG) << "AnimationsManager actor was cleared" << timer;
attach_menu_manager_actor_.reset();
LOG(DEBUG) << "AttachMenuManager actor was cleared" << timer;
auth_manager_actor_.reset();
LOG(DEBUG) << "AuthManager actor was cleared" << timer;
autosave_manager_actor_.reset();
LOG(DEBUG) << "AutosaveManager actor was cleared" << timer;
background_manager_actor_.reset();
LOG(DEBUG) << "BackgroundManager actor was cleared" << timer;
boost_manager_actor_.reset();
LOG(DEBUG) << "BoostManager actor was cleared" << timer;
bot_info_manager_actor_.reset();
LOG(DEBUG) << "BotInfoManager actor was cleared" << timer;
common_dialog_manager_actor_.reset();
LOG(DEBUG) << "CommonDialogManager actor was cleared" << timer;
contacts_manager_actor_.reset();
LOG(DEBUG) << "ContactsManager actor was cleared" << timer;
country_info_manager_actor_.reset();
LOG(DEBUG) << "CountryInfoManager actor was cleared" << timer;
dialog_action_manager_actor_.reset();
LOG(DEBUG) << "DialogActionManager actor was cleared" << timer;
dialog_filter_manager_actor_.reset();
LOG(DEBUG) << "DialogFilterManager actor was cleared" << timer;
dialog_invite_link_manager_actor_.reset();
LOG(DEBUG) << "DialogInviteLinkManager actor was cleared" << timer;
dialog_manager_actor_.reset();
LOG(DEBUG) << "DialogManager actor was cleared" << timer;
dialog_participant_manager_actor_.reset();
LOG(DEBUG) << "DialogParticipantManager actor was cleared" << timer;
download_manager_actor_.reset();
LOG(DEBUG) << "DownloadManager actor was cleared" << timer;
file_manager_actor_.reset();
LOG(DEBUG) << "FileManager actor was cleared" << timer;
file_reference_manager_actor_.reset();
LOG(DEBUG) << "FileReferenceManager actor was cleared" << timer;
forum_topic_manager_actor_.reset();
LOG(DEBUG) << "ForumTopicManager actor was cleared" << timer;
game_manager_actor_.reset();
LOG(DEBUG) << "GameManager actor was cleared" << timer;
group_call_manager_actor_.reset();
LOG(DEBUG) << "GroupCallManager actor was cleared" << timer;
inline_queries_manager_actor_.reset();
LOG(DEBUG) << "InlineQueriesManager actor was cleared" << timer;
link_manager_actor_.reset();
LOG(DEBUG) << "LinkManager actor was cleared" << timer;
message_import_manager_actor_.reset();
LOG(DEBUG) << "MessageImportManager actor was cleared" << timer;
messages_manager_actor_.reset();
LOG(DEBUG) << "MessagesManager actor was cleared" << timer;
notification_manager_actor_.reset();
LOG(DEBUG) << "NotificationManager actor was cleared" << timer;
notification_settings_manager_actor_.reset();
LOG(DEBUG) << "NotificationSettingsManager actor was cleared" << timer;
poll_manager_actor_.reset();
LOG(DEBUG) << "PollManager actor was cleared" << timer;
privacy_manager_actor_.reset();
LOG(DEBUG) << "PrivacyManager actor was cleared" << timer;
reaction_manager_actor_.reset();
LOG(DEBUG) << "ReactionManager actor was cleared" << timer;
sponsored_message_manager_actor_.reset();
LOG(DEBUG) << "SponsoredMessageManager actor was cleared" << timer;
statistics_manager_actor_.reset();
LOG(DEBUG) << "StatisticsManager actor was cleared" << timer;
stickers_manager_actor_.reset();
LOG(DEBUG) << "StickersManager actor was cleared" << timer;
story_manager_actor_.reset();
LOG(DEBUG) << "StoryManager actor was cleared" << timer;
theme_manager_actor_.reset();
LOG(DEBUG) << "ThemeManager actor was cleared" << timer;
top_dialog_manager_actor_.reset();
LOG(DEBUG) << "TopDialogManager actor was cleared" << timer;
transcription_manager_actor_.reset();
LOG(DEBUG) << "TranscriptionManager actor was cleared" << timer;
translation_manager_actor_.reset();
LOG(DEBUG) << "TranslationManager actor was cleared" << timer;
updates_manager_actor_.reset();
LOG(DEBUG) << "UpdatesManager actor was cleared" << timer;
video_notes_manager_actor_.reset();
LOG(DEBUG) << "VideoNotesManager actor was cleared" << timer;
voice_notes_manager_actor_.reset();
LOG(DEBUG) << "VoiceNotesManager actor was cleared" << timer;
web_pages_manager_actor_.reset();
LOG(DEBUG) << "WebPagesManager actor was cleared" << timer;
reset_actor(ActorOwn<Actor>(std::move(account_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(animations_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(attach_menu_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(auth_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(autosave_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(background_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(boost_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(bot_info_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(common_dialog_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(contacts_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(country_info_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(dialog_action_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(dialog_filter_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(dialog_invite_link_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(dialog_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(dialog_participant_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(download_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(file_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(file_reference_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(forum_topic_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(game_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(group_call_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(inline_queries_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(link_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(message_import_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(messages_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(notification_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(notification_settings_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(poll_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(privacy_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(reaction_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(sponsored_message_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(statistics_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(stickers_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(story_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(theme_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(top_dialog_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(transcription_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(translation_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(updates_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(video_notes_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(voice_notes_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(web_pages_manager_actor_)));
LOG(DEBUG) << "All actors were cleared" << timer;
}
void Td::close() {