in src/app/AthenaNetCore/AthenaNetCore.BusinessLogic/Extentions/AmazonAthenaClientExtentions.cs [168:190]
private static async Task WaitForQueryToComplete(IAmazonAthena athenaClient, string queryExecutionId, int timeout)
{
bool isQueryStillRunning = true;
DateTimeOffset endTimeOffset = DateTimeOffset.Now.AddMinutes(timeout);
while (isQueryStillRunning && DateTimeOffset.Now <= endTimeOffset)
{
isQueryStillRunning = await athenaClient.IsTheQueryStillRunning(queryExecutionId);
if (isQueryStillRunning)
{
// Sleep an amount of time before retrying again.
await Task.Delay(SLEEP_AMOUNT_IN_MS);
}
}
if (isQueryStillRunning && DateTimeOffset.Now > endTimeOffset)
{
throw new AmazonAthenaException("Timeout: Amazon Athena still processing your query, use the RequestId to get the result later.")
{
RequestId = queryExecutionId
};
}
}