fix late lastLoadedPostDate initialization

This commit is contained in:
Slavasil 2025-01-05 03:08:03 +03:00
parent 3333013fd1
commit 7ed3f0193f

View File

@ -60,6 +60,12 @@ void RepostManager::load_more_telegram_chats() {
void RepostManager::start() { void RepostManager::start() {
m_nRequiredChats = 100500;//m_appConfig->tgSources.size() + 1; m_nRequiredChats = 100500;//m_appConfig->tgSources.size() + 1;
for (auto &appState : m_appState->vkRepostState) {
appState.lastLoadedPostDate = appState.lastForwardedPostDate;
}
for (auto &appState : m_appState->tgRepostState) {
appState.lastLoadedPostDate = appState.lastForwardedPostDate;
}
m_tg.add_update_handler([this](void*, td_api::Object &obj){ m_tg.add_update_handler([this](void*, td_api::Object &obj){
if (obj.get_id() == td_api::updateAuthorizationState::ID) { if (obj.get_id() == td_api::updateAuthorizationState::ID) {
auto &authState = (td_api::updateAuthorizationState&)obj; auto &authState = (td_api::updateAuthorizationState&)obj;
@ -344,12 +350,6 @@ void NewPostFetcher::check_tg_posts(int index, std::vector<td::tl::unique_ptr<td
} }
void RepostManager::on_clients_ready() { void RepostManager::on_clients_ready() {
for (auto &appState : m_appState->vkRepostState) {
appState.lastLoadedPostDate = appState.lastForwardedPostDate;
}
for (auto &appState : m_appState->tgRepostState) {
appState.lastLoadedPostDate = appState.lastForwardedPostDate;
}
spdlog::info("checking all sources"); spdlog::info("checking all sources");
m_fetcher.fetch( m_fetcher.fetch(