diff options
Diffstat (limited to 'protocols/VKontakte')
-rw-r--r-- | protocols/VKontakte/src/vk_chats.cpp | 2 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_queue.cpp | 4 |
2 files changed, 4 insertions, 2 deletions
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
}
}
|