|
|
@ -10,6 +10,8 @@ |
|
|
|
#include "websockets.h" |
|
|
|
#include "Model/ChatItem.h" |
|
|
|
#include "DataStore/DataStore.h" |
|
|
|
#include <thread> |
|
|
|
|
|
|
|
|
|
|
|
ChatModel *chatModel = new ChatModel(); |
|
|
|
Chat *chat = new Chat(); |
|
|
@ -302,9 +304,19 @@ void Controller::processInfo(const json& info) |
|
|
|
|
|
|
|
void Controller::getInfoThenRefresh(bool force) |
|
|
|
{ |
|
|
|
qDebug()<< __func__; |
|
|
|
if (!zrpc->haveConnection()) |
|
|
|
return noConnection(); |
|
|
|
qDebug()<< __func__; |
|
|
|
int attempts = 0; |
|
|
|
int max_attempts = 10; |
|
|
|
|
|
|
|
while (!zrpc->haveConnection()) { |
|
|
|
if (attempts >= max_attempts) { |
|
|
|
return noConnection(); |
|
|
|
} |
|
|
|
|
|
|
|
std::this_thread::sleep_for(std::chrono::seconds(2 * attempts)); |
|
|
|
attempts++; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static bool prevCallSucceeded = false; |
|
|
|
|
|
|
|