Add a timeout of approximately 24 hours to the TickUntilCompletion method.

This commit is contained in:
Callum McIntyre 2016-10-24 16:13:44 +01:00
parent bb78309279
commit f11ed643b6

View File

@ -47,6 +47,7 @@ namespace XenAdmin.Actions.OVFActions
protected XenOvfTransportBase m_transportAction; protected XenOvfTransportBase m_transportAction;
private const int SLEEP_TIME = 900; private const int SLEEP_TIME = 900;
private const int MAX_ITERATIONS = 60 * 60 * 24; // seconds in 24 hours
/// <summary> /// <summary>
/// RBAC dependencies needed to import appliance/export an appliance/import disk image. /// RBAC dependencies needed to import appliance/export an appliance/import disk image.
@ -114,7 +115,8 @@ namespace XenAdmin.Actions.OVFActions
private void TickUntilCompletion() private void TickUntilCompletion()
{ {
while (!IsCompleted) int i = 0;
while (!IsCompleted && ++i<MAX_ITERATIONS)
{ {
OnChanged(); OnChanged();
Thread.Sleep(SLEEP_TIME); Thread.Sleep(SLEEP_TIME);