added proper timeout of 5 secs to all forum async-ed interactions

This commit is contained in:
csoler 2018-12-11 22:06:45 +01:00
parent b38c635649
commit 8f9c9295b2
No known key found for this signature in database
GPG Key ID: 7BCA522266C0804C
2 changed files with 10 additions and 8 deletions

View File

@ -389,7 +389,7 @@ bool p3GxsForums::createForum(RsGxsForumGroup& forum)
return false; return false;
} }
if(waitToken(token) != RsTokenService::COMPLETE) if(waitToken(token,std::chrono::milliseconds(5000)) != RsTokenService::COMPLETE)
{ {
std::cerr << __PRETTY_FUNCTION__ << "Error! GXS operation failed." std::cerr << __PRETTY_FUNCTION__ << "Error! GXS operation failed."
<< std::endl; << std::endl;
@ -416,7 +416,7 @@ bool p3GxsForums::editForum(RsGxsForumGroup& forum)
return false; return false;
} }
if(waitToken(token) != RsTokenService::COMPLETE) if(waitToken(token,std::chrono::milliseconds(5000)) != RsTokenService::COMPLETE)
{ {
std::cerr << __PRETTY_FUNCTION__ << "Error! GXS operation failed." std::cerr << __PRETTY_FUNCTION__ << "Error! GXS operation failed."
<< std::endl; << std::endl;
@ -440,7 +440,7 @@ bool p3GxsForums::getForumsSummaries(
RsTokReqOptions opts; RsTokReqOptions opts;
opts.mReqType = GXS_REQUEST_TYPE_GROUP_META; opts.mReqType = GXS_REQUEST_TYPE_GROUP_META;
if( !requestGroupInfo(token, opts) if( !requestGroupInfo(token, opts)
|| waitToken(token) != RsTokenService::COMPLETE ) return false; || waitToken(token,std::chrono::milliseconds(5000)) != RsTokenService::COMPLETE ) return false;
return getGroupSummary(token, forums); return getGroupSummary(token, forums);
} }
@ -452,7 +452,7 @@ bool p3GxsForums::getForumsInfo(
RsTokReqOptions opts; RsTokReqOptions opts;
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA; opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
if( !requestGroupInfo(token, opts, forumIds) if( !requestGroupInfo(token, opts, forumIds)
|| waitToken(token) != RsTokenService::COMPLETE ) return false; || waitToken(token,std::chrono::milliseconds(5000)) != RsTokenService::COMPLETE ) return false;
return getGroupData(token, forumsInfo); return getGroupData(token, forumsInfo);
} }
@ -465,7 +465,7 @@ bool p3GxsForums::getForumsContent( const RsGxsGroupId& forumId, std::set<RsGxsM
GxsMsgReq msgIds; GxsMsgReq msgIds;
msgIds[forumId] = msgs_to_request; msgIds[forumId] = msgs_to_request;
if( !requestMsgInfo(token, opts, msgIds) || waitToken(token) != RsTokenService::COMPLETE ) return false; if( !requestMsgInfo(token, opts, msgIds) || waitToken(token,std::chrono::milliseconds(5000)) != RsTokenService::COMPLETE ) return false;
return getMsgData(token, msgs) ; return getMsgData(token, msgs) ;
} }
@ -486,7 +486,7 @@ bool p3GxsForums::markRead(const RsGxsGrpMsgIdPair& msgId, bool read)
{ {
uint32_t token; uint32_t token;
setMessageReadStatus(token, msgId, read); setMessageReadStatus(token, msgId, read);
if(waitToken(token) != RsTokenService::COMPLETE ) return false; if(waitToken(token,std::chrono::milliseconds(5000)) != RsTokenService::COMPLETE ) return false;
return true; return true;
} }
@ -522,7 +522,7 @@ bool p3GxsForums::createMessage(RsGxsForumMsg& message)
{ {
uint32_t token; uint32_t token;
if( !createMsg(token, message) if( !createMsg(token, message)
|| waitToken(token) != RsTokenService::COMPLETE ) return false; || waitToken(token,std::chrono::milliseconds(5000)) != RsTokenService::COMPLETE ) return false;
if(RsGenExchange::getPublishedMsgMeta(token, message.mMeta)) return true; if(RsGenExchange::getPublishedMsgMeta(token, message.mMeta)) return true;

View File

@ -83,6 +83,7 @@
// We need consts for that!! Defined in multiple places. // We need consts for that!! Defined in multiple places.
#ifdef TO_REMOVE
#define ROLE_THREAD_MSGID Qt::UserRole #define ROLE_THREAD_MSGID Qt::UserRole
#define ROLE_THREAD_STATUS Qt::UserRole + 1 #define ROLE_THREAD_STATUS Qt::UserRole + 1
#define ROLE_THREAD_MISSING Qt::UserRole + 2 #define ROLE_THREAD_MISSING Qt::UserRole + 2
@ -94,6 +95,7 @@
#define ROLE_THREAD_PINNED Qt::UserRole + 7 #define ROLE_THREAD_PINNED Qt::UserRole + 7
#define ROLE_THREAD_COUNT 4 #define ROLE_THREAD_COUNT 4
#endif
#ifdef DEBUG_FORUMS #ifdef DEBUG_FORUMS
static std::ostream& operator<<(std::ostream& o,const QModelIndex& q) static std::ostream& operator<<(std::ostream& o,const QModelIndex& q)
@ -174,7 +176,7 @@ public:
unsigned int read_status = qvariant_cast<uint32_t>(index.data(Qt::DecorationRole)); unsigned int read_status = qvariant_cast<uint32_t>(index.data(Qt::DecorationRole));
bool unread = IS_MSG_UNREAD(read_status); bool unread = IS_MSG_UNREAD(read_status);
bool missing = index.sibling(index.row(),RsGxsForumModel::COLUMN_THREAD_DATA).data(ROLE_THREAD_MISSING).toBool(); bool missing = index.sibling(index.row(),RsGxsForumModel::COLUMN_THREAD_DATA).data(RsGxsForumModel::MissingRole).toBool();
// set icon // set icon
if (missing) if (missing)