1
This commit is contained in:
parent
3b52644e4e
commit
3ebe020780
@ -916,6 +916,9 @@ void Player::ProcessEventTimerFunc()
|
|||||||
if (curr_max_event_idx_ >= DBEngine::Instance()->GetEventCurrIdx(myself.crc32_code)) {
|
if (curr_max_event_idx_ >= DBEngine::Instance()->GetEventCurrIdx(myself.crc32_code)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (event_fetching_) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (last_event_idx_ >= curr_max_event_idx_) {
|
if (last_event_idx_ >= curr_max_event_idx_) {
|
||||||
curr_max_event_idx_ = DBEngine::Instance()->GetEventCurrIdx(myself.crc32_code);
|
curr_max_event_idx_ = DBEngine::Instance()->GetEventCurrIdx(myself.crc32_code);
|
||||||
}
|
}
|
||||||
@ -931,15 +934,22 @@ void Player::ProcessEventTimerFunc()
|
|||||||
long long last_event_idx = param.param2;
|
long long last_event_idx = param.param2;
|
||||||
Player* hum = PlayerMgr::Instance()->GetPlayerByAccountId(account_id);
|
Player* hum = PlayerMgr::Instance()->GetPlayerByAccountId(account_id);
|
||||||
if (hum) {
|
if (hum) {
|
||||||
|
hum->event_fetching_ = false;
|
||||||
hum->last_event_idx_ = curr_max_event_idx;
|
hum->last_event_idx_ = curr_max_event_idx;
|
||||||
hum->OnFetchEvent(curr_max_event_idx, data_set);
|
hum->OnFetchEvent(data_set);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
auto on_error =
|
auto on_error =
|
||||||
[] (a8::XParams& param, int error_code, const std::string& error_msg)
|
[] (a8::XParams& param, int error_code, const std::string& error_msg)
|
||||||
{
|
{
|
||||||
|
std::string account_id = param.sender.GetString();
|
||||||
|
Player* hum = PlayerMgr::Instance()->GetPlayerByAccountId(account_id);
|
||||||
|
if (hum) {
|
||||||
|
hum->event_fetching_ = false;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
event_fetching_ = true;
|
||||||
a8::XObject conn_info = DBEngine::Instance()->GetConnInfo(myself.crc32_code);
|
a8::XObject conn_info = DBEngine::Instance()->GetConnInfo(myself.crc32_code);
|
||||||
DBEngine::Instance()->ExecAsyncQuery
|
DBEngine::Instance()->ExecAsyncQuery
|
||||||
(
|
(
|
||||||
@ -962,9 +972,8 @@ void Player::ProcessEventTimerFunc()
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::OnFetchEvent(long long max_event_idx, const f8::DataSet* data_set)
|
void Player::OnFetchEvent(const f8::DataSet* data_set)
|
||||||
{
|
{
|
||||||
curr_max_event_idx_ = max_event_idx;
|
|
||||||
if (data_set) {
|
if (data_set) {
|
||||||
for (auto& row : *data_set) {
|
for (auto& row : *data_set) {
|
||||||
Event event;
|
Event event;
|
||||||
|
@ -123,7 +123,7 @@ private:
|
|||||||
void PushFriendList();
|
void PushFriendList();
|
||||||
void SyncOtherFriend();
|
void SyncOtherFriend();
|
||||||
void ProcessEventTimerFunc();
|
void ProcessEventTimerFunc();
|
||||||
void OnFetchEvent(long long max_event_idx, const f8::DataSet* data_set);
|
void OnFetchEvent(const f8::DataSet* data_set);
|
||||||
void ProcessEvent();
|
void ProcessEvent();
|
||||||
void OnFriendAgreeEvent(Event& event);
|
void OnFriendAgreeEvent(Event& event);
|
||||||
void OnFriendDeleteEvent(Event& event);
|
void OnFriendDeleteEvent(Event& event);
|
||||||
@ -142,6 +142,7 @@ private:
|
|||||||
long long last_apply_idx_ = 0;
|
long long last_apply_idx_ = 0;
|
||||||
long long last_event_idx_ = 0;
|
long long last_event_idx_ = 0;
|
||||||
long long curr_max_event_idx_ = 0;
|
long long curr_max_event_idx_ = 0;
|
||||||
|
bool event_fetching_ = false;
|
||||||
long long last_run_tick_ = 0;
|
long long last_run_tick_ = 0;
|
||||||
std::map<long long, Event> event_hash_;
|
std::map<long long, Event> event_hash_;
|
||||||
int red_point_flags_ = 0;
|
int red_point_flags_ = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user