mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Regression Test: Add timeout to command object processing
When Octave scripts fails, the application ends up in a deadlock. Add timing to be able to process next regression tests.
This commit is contained in:
parent
f7dc85ddb6
commit
000605bd99
@ -1340,6 +1340,9 @@ void RiaApplication::executeCommandObjects()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RiaApplication::waitUntilCommandObjectsHasBeenProcessed()
|
void RiaApplication::waitUntilCommandObjectsHasBeenProcessed()
|
||||||
{
|
{
|
||||||
|
auto start = std::chrono::system_clock::now();
|
||||||
|
const double timeoutThreshold = 5.0;
|
||||||
|
|
||||||
// Wait until all command objects have completed
|
// Wait until all command objects have completed
|
||||||
bool mutexLockedSuccessfully = m_commandQueueLock.tryLock();
|
bool mutexLockedSuccessfully = m_commandQueueLock.tryLock();
|
||||||
|
|
||||||
@ -1348,7 +1351,18 @@ void RiaApplication::waitUntilCommandObjectsHasBeenProcessed()
|
|||||||
invokeProcessEvents();
|
invokeProcessEvents();
|
||||||
|
|
||||||
mutexLockedSuccessfully = m_commandQueueLock.tryLock();
|
mutexLockedSuccessfully = m_commandQueueLock.tryLock();
|
||||||
|
|
||||||
|
std::chrono::duration<double> elapsed_seconds = std::chrono::system_clock::now() - start;
|
||||||
|
if ( timeoutThreshold < elapsed_seconds.count() )
|
||||||
|
{
|
||||||
|
// This can happen if the octave plugins fails to execute during regression testing.
|
||||||
|
|
||||||
|
RiaLogging::warning(
|
||||||
|
QString( "Timeout waiting for command objects to complete, timeout set to %1 seconds." ).arg( timeoutThreshold ) );
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_commandQueueLock.unlock();
|
m_commandQueueLock.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user