Add source to save_active_stories.
This commit is contained in:
parent
b5f1e6a772
commit
2eef3a459b
@ -1299,7 +1299,7 @@ StoryManager::ActiveStories *StoryManager::on_get_active_stories_from_database(D
|
|||||||
if (status.is_error()) {
|
if (status.is_error()) {
|
||||||
LOG(ERROR) << "Receive invalid active stories in " << owner_dialog_id << " from database: " << status << ' '
|
LOG(ERROR) << "Receive invalid active stories in " << owner_dialog_id << " from database: " << status << ' '
|
||||||
<< format::as_hex_dump<4>(value.as_slice());
|
<< format::as_hex_dump<4>(value.as_slice());
|
||||||
save_active_stories(owner_dialog_id, nullptr, Promise<Unit>());
|
save_active_stories(owner_dialog_id, nullptr, Promise<Unit>(), "on_get_active_stories_from_database");
|
||||||
failed_to_load_active_stories_.insert(owner_dialog_id);
|
failed_to_load_active_stories_.insert(owner_dialog_id);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -2913,7 +2913,7 @@ void StoryManager::on_update_active_stories(DialogId owner_dialog_id, StoryId ma
|
|||||||
max_read_story_ids_.erase(owner_dialog_id);
|
max_read_story_ids_.erase(owner_dialog_id);
|
||||||
}
|
}
|
||||||
if (!from_database) {
|
if (!from_database) {
|
||||||
save_active_stories(owner_dialog_id, nullptr, std::move(promise));
|
save_active_stories(owner_dialog_id, nullptr, std::move(promise), "on_update_active_stories 1");
|
||||||
}
|
}
|
||||||
failed_to_load_active_stories_.insert(owner_dialog_id);
|
failed_to_load_active_stories_.insert(owner_dialog_id);
|
||||||
return;
|
return;
|
||||||
@ -2947,7 +2947,7 @@ void StoryManager::on_update_active_stories(DialogId owner_dialog_id, StoryId ma
|
|||||||
send_update_chat_active_stories(owner_dialog_id, active_stories.get());
|
send_update_chat_active_stories(owner_dialog_id, active_stories.get());
|
||||||
}
|
}
|
||||||
if (need_save_to_database && !from_database) {
|
if (need_save_to_database && !from_database) {
|
||||||
save_active_stories(owner_dialog_id, active_stories.get(), std::move(promise));
|
save_active_stories(owner_dialog_id, active_stories.get(), std::move(promise), "on_update_active_stories 2");
|
||||||
} else {
|
} else {
|
||||||
promise.set_value(Unit());
|
promise.set_value(Unit());
|
||||||
}
|
}
|
||||||
@ -3062,15 +3062,15 @@ void StoryManager::send_update_chat_active_stories(DialogId owner_dialog_id,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void StoryManager::save_active_stories(DialogId owner_dialog_id, const ActiveStories *active_stories,
|
void StoryManager::save_active_stories(DialogId owner_dialog_id, const ActiveStories *active_stories,
|
||||||
Promise<Unit> &&promise) const {
|
Promise<Unit> &&promise, const char *source) const {
|
||||||
if (!G()->use_message_database()) {
|
if (!G()->use_message_database()) {
|
||||||
return promise.set_value(Unit());
|
return promise.set_value(Unit());
|
||||||
}
|
}
|
||||||
if (active_stories == nullptr) {
|
if (active_stories == nullptr) {
|
||||||
LOG(INFO) << "Delete active stories of " << owner_dialog_id << " from database";
|
LOG(INFO) << "Delete active stories of " << owner_dialog_id << " from database from " << source;
|
||||||
G()->td_db()->get_story_db_async()->delete_active_stories(owner_dialog_id, std::move(promise));
|
G()->td_db()->get_story_db_async()->delete_active_stories(owner_dialog_id, std::move(promise));
|
||||||
} else {
|
} else {
|
||||||
LOG(INFO) << "Add active stories of " << owner_dialog_id << " to database";
|
LOG(INFO) << "Add active stories of " << owner_dialog_id << " to database from " << source;
|
||||||
auto order = active_stories->story_list_id_.is_valid() ? active_stories->private_order_ : 0;
|
auto order = active_stories->story_list_id_.is_valid() ? active_stories->private_order_ : 0;
|
||||||
SavedActiveStories saved_active_stories;
|
SavedActiveStories saved_active_stories;
|
||||||
saved_active_stories.max_read_story_id_ = active_stories->max_read_story_id_;
|
saved_active_stories.max_read_story_id_ = active_stories->max_read_story_id_;
|
||||||
@ -3172,7 +3172,7 @@ void StoryManager::on_dialog_active_stories_order_updated(DialogId owner_dialog_
|
|||||||
send_update_chat_active_stories(owner_dialog_id, active_stories);
|
send_update_chat_active_stories(owner_dialog_id, active_stories);
|
||||||
}
|
}
|
||||||
if (need_save_to_database) {
|
if (need_save_to_database) {
|
||||||
save_active_stories(owner_dialog_id, active_stories, Promise<Unit>());
|
save_active_stories(owner_dialog_id, active_stories, Promise<Unit>(), "on_dialog_active_stories_order_updated");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -480,8 +480,8 @@ class StoryManager final : public Actor {
|
|||||||
|
|
||||||
void send_update_chat_active_stories(DialogId owner_dialog_id, const ActiveStories *active_stories) const;
|
void send_update_chat_active_stories(DialogId owner_dialog_id, const ActiveStories *active_stories) const;
|
||||||
|
|
||||||
void save_active_stories(DialogId owner_dialog_id, const ActiveStories *active_stories,
|
void save_active_stories(DialogId owner_dialog_id, const ActiveStories *active_stories, Promise<Unit> &&promise,
|
||||||
Promise<Unit> &&promise) const;
|
const char *source) const;
|
||||||
|
|
||||||
void increment_story_views(DialogId owner_dialog_id, PendingStoryViews &story_views);
|
void increment_story_views(DialogId owner_dialog_id, PendingStoryViews &story_views);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user