Reload opened stories once a minute.
This commit is contained in:
parent
70e84101ac
commit
0f9f380509
@ -964,6 +964,10 @@ void StoryManager::open_story(DialogId owner_dialog_id, StoryId story_id, Promis
|
|||||||
return promise.set_value(Unit());
|
return promise.set_value(Unit());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (story_id.is_server() && story->receive_date_ < G()->unix_time() - OPENED_STORY_POLL_PERIOD) {
|
||||||
|
reload_story(story_full_id, Auto());
|
||||||
|
}
|
||||||
|
|
||||||
for (auto file_id : get_story_file_ids(story)) {
|
for (auto file_id : get_story_file_ids(story)) {
|
||||||
td_->file_manager_->check_local_location_async(file_id, true);
|
td_->file_manager_->check_local_location_async(file_id, true);
|
||||||
}
|
}
|
||||||
@ -1458,6 +1462,8 @@ StoryId StoryManager::on_get_story(DialogId owner_dialog_id,
|
|||||||
}
|
}
|
||||||
CHECK(story != nullptr);
|
CHECK(story != nullptr);
|
||||||
|
|
||||||
|
story->receive_date_ = G()->unix_time();
|
||||||
|
|
||||||
bool is_bot = td_->auth_manager_->is_bot();
|
bool is_bot = td_->auth_manager_->is_bot();
|
||||||
auto caption =
|
auto caption =
|
||||||
get_message_text(td_->contacts_manager_.get(), std::move(story_item->caption_), std::move(story_item->entities_),
|
get_message_text(td_->contacts_manager_.get(), std::move(story_item->caption_), std::move(story_item->entities_),
|
||||||
|
@ -42,6 +42,7 @@ class StoryManager final : public Actor {
|
|||||||
struct Story {
|
struct Story {
|
||||||
int32 date_ = 0;
|
int32 date_ = 0;
|
||||||
int32 expire_date_ = 0;
|
int32 expire_date_ = 0;
|
||||||
|
int32 receive_date_ = 0;
|
||||||
bool is_pinned_ = false;
|
bool is_pinned_ = false;
|
||||||
bool is_public_ = false;
|
bool is_public_ = false;
|
||||||
bool is_for_close_friends_ = false;
|
bool is_for_close_friends_ = false;
|
||||||
@ -188,6 +189,8 @@ class StoryManager final : public Actor {
|
|||||||
class DeleteStoryOnServerLogEvent;
|
class DeleteStoryOnServerLogEvent;
|
||||||
class ReadStoriesOnServerLogEvent;
|
class ReadStoriesOnServerLogEvent;
|
||||||
|
|
||||||
|
static constexpr int32 OPENED_STORY_POLL_PERIOD = 60;
|
||||||
|
|
||||||
void start_up() final;
|
void start_up() final;
|
||||||
|
|
||||||
void tear_down() final;
|
void tear_down() final;
|
||||||
|
Loading…
Reference in New Issue
Block a user