mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-01 03:37:15 -06:00
Python: gRPC timeout
This commit is contained in:
parent
c075f7b352
commit
df2fe42c4a
@ -112,6 +112,7 @@
|
||||
#include "cvfProgramOptions.h"
|
||||
#include "cvfqtUtils.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QErrorMessage>
|
||||
#include <QFileDialog>
|
||||
@ -1238,7 +1239,7 @@ void RiaGuiApplication::launchGrpcServer()
|
||||
m_grpcServer->runInThread();
|
||||
m_idleTimer = new QTimer(this);
|
||||
connect(m_idleTimer, SIGNAL(timeout()), this, SLOT(runIdleProcessing()));
|
||||
m_idleTimer->start(0);
|
||||
m_idleTimer->start(5);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -1696,7 +1697,24 @@ void RiaGuiApplication::runIdleProcessing()
|
||||
}
|
||||
else if (!caf::ProgressInfoStatic::isRunning())
|
||||
{
|
||||
m_grpcServer->processAllQueuedRequests();
|
||||
static int idleIterationCount = 0;
|
||||
int iterationInterval = 0;
|
||||
if (m_grpcServer->processAllQueuedRequests() > 0)
|
||||
{
|
||||
idleIterationCount = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
idleIterationCount = std::min(++idleIterationCount, 500);
|
||||
if (idleIterationCount == 500)
|
||||
{
|
||||
iterationInterval = 5;
|
||||
}
|
||||
}
|
||||
if (iterationInterval != m_idleTimer->interval())
|
||||
{
|
||||
m_idleTimer->setInterval(iterationInterval);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ public:
|
||||
void run();
|
||||
void runInThread();
|
||||
void initialize();
|
||||
void processAllQueuedRequests();
|
||||
size_t processAllQueuedRequests();
|
||||
void quit();
|
||||
|
||||
private:
|
||||
@ -168,7 +168,7 @@ void RiaGrpcServerImpl::initialize()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaGrpcServerImpl::processAllQueuedRequests()
|
||||
size_t RiaGrpcServerImpl::processAllQueuedRequests()
|
||||
{
|
||||
std::list<RiaGrpcCallbackInterface*> waitingRequests;
|
||||
{
|
||||
@ -176,6 +176,8 @@ void RiaGrpcServerImpl::processAllQueuedRequests()
|
||||
std::lock_guard<std::mutex> requestLock(m_requestMutex);
|
||||
waitingRequests.swap(m_unprocessedRequests);
|
||||
}
|
||||
size_t count = waitingRequests.size();
|
||||
|
||||
// Now free to receive new requests from client while processing the current ones.
|
||||
while (!waitingRequests.empty())
|
||||
{
|
||||
@ -183,6 +185,7 @@ void RiaGrpcServerImpl::processAllQueuedRequests()
|
||||
waitingRequests.pop_front();
|
||||
process(method);
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -339,9 +342,9 @@ void RiaGrpcServer::initialize()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaGrpcServer::processAllQueuedRequests()
|
||||
size_t RiaGrpcServer::processAllQueuedRequests()
|
||||
{
|
||||
m_serverImpl->processAllQueuedRequests();
|
||||
return m_serverImpl->processAllQueuedRequests();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -41,7 +41,7 @@ public:
|
||||
bool isRunning() const;
|
||||
void run();
|
||||
void runInThread();
|
||||
void processAllQueuedRequests();
|
||||
size_t processAllQueuedRequests();
|
||||
void quit();
|
||||
static int findAvailablePortNumber(int defaultPortNumber);
|
||||
static void setReceivedExitRequest();
|
||||
|
Loading…
Reference in New Issue
Block a user