From ca65019975d21b5cd96b71499b6d675c3b11e2a9 Mon Sep 17 00:00:00 2001 From: ElzorFox Date: Sun, 19 Mar 2017 01:36:11 +0500 Subject: VKontakte: fix sending unneeded GetServerHistory requestes tempory (?) increase timeout between API requests --- protocols/VKontakte/src/misc.cpp | 2 +- protocols/VKontakte/src/vk_history.cpp | 2 +- protocols/VKontakte/src/vk_queue.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index 6938f7fdb2..284ff08032 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -317,7 +317,7 @@ bool CVkProto::CheckJsonResult(AsyncHttpRequest *pReq, const JSONNode &jnNode) case VKERR_INTERNAL_SERVER_ERR: if (pReq->m_iRetry > 0) { pReq->bNeedsRestart = true; - Sleep(500); //Pause for fix err + Sleep(1000); //Pause for fix err debugLogA("CVkProto::CheckJsonResult Retry = %d", pReq->m_iRetry); pReq->m_iRetry--; } diff --git a/protocols/VKontakte/src/vk_history.cpp b/protocols/VKontakte/src/vk_history.cpp index 4f71591353..305182ee81 100644 --- a/protocols/VKontakte/src/vk_history.cpp +++ b/protocols/VKontakte/src/vk_history.cpp @@ -116,7 +116,7 @@ void CVkProto::GetServerHistoryLastNDay(MCONTACT hContact, int NDay) void CVkProto::GetServerHistory(MCONTACT hContact, int iOffset, int iCount, int iTime, int iLastMsgId, bool once) { debugLogA("CVkProto::GetServerHistory %d %d %d %d %d", iOffset, iCount, iTime, iLastMsgId, (int)once); - if (!IsOnline()) + if (!IsOnline() || iCount == 0) return; LONG userID = getDword(hContact, "ID", VK_INVALID_USER); diff --git a/protocols/VKontakte/src/vk_queue.cpp b/protocols/VKontakte/src/vk_queue.cpp index 870575837b..d23c68e995 100644 --- a/protocols/VKontakte/src/vk_queue.cpp +++ b/protocols/VKontakte/src/vk_queue.cpp @@ -166,7 +166,7 @@ void CVkProto::WorkerThread(void*) break; ExecuteRequest(pReq); if (need_sleep) { // There can be maximum 3 requests to API methods per second from a client - Sleep(330); // (c) https://vk.com/dev/api_requests + Sleep(800); // (c) https://vk.com/dev/api_requests debugLogA("CVkProto::WorkerThread: need sleep"); } } -- cgit v1.2.3