From 4eb09f2d68b16951f2a3ff848bdf20ab6566170f Mon Sep 17 00:00:00 2001 From: Sergey Bolhovskoy Date: Fri, 12 Sep 2014 04:12:46 +0000 Subject: =?UTF-8?q?VKontakte:=20fix=20for=20view=20chat=20messages=20in=20?= =?UTF-8?q?chatlog=20global=20fix=20for=20=E2=80=98Too=20many=20requests?= =?UTF-8?q?=20per=20second=E2=80=99=20error?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://svn.miranda-ng.org/main/trunk@10435 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/VKontakte/src/vk_chats.cpp | 2 -- protocols/VKontakte/src/vk_queue.cpp | 4 ++++ 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'protocols/VKontakte/src') diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp index a60cc2fc31..63df8015fe 100644 --- a/protocols/VKontakte/src/vk_chats.cpp +++ b/protocols/VKontakte/src/vk_chats.cpp @@ -365,8 +365,6 @@ void CVkProto::OnSendChatMsg(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) if (reply->resultCode == 200) { JSONROOT pRoot; JSONNODE *pResponse = CheckJsonResponse(pReq, reply, pRoot); - if (pResponse != NULL) - m_sendIds.insert((void*)json_as_int(pResponse)); } } diff --git a/protocols/VKontakte/src/vk_queue.cpp b/protocols/VKontakte/src/vk_queue.cpp index bb506bd0ce..c1934fa190 100644 --- a/protocols/VKontakte/src/vk_queue.cpp +++ b/protocols/VKontakte/src/vk_queue.cpp @@ -103,6 +103,7 @@ void CVkProto::WorkerThread(void*) break; AsyncHttpRequest *pReq; + bool need_sleep = false; while(true) { { mir_cslock lck(m_csRequestsQueue); @@ -111,8 +112,11 @@ void CVkProto::WorkerThread(void*) pReq = m_arRequestsQueue[0]; m_arRequestsQueue.remove(0); + need_sleep = (m_arRequestsQueue.getCount() > 1); // more than two to not gather } 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 } } -- cgit v1.2.3