private async Task CloseWaitingItem(WaitingToClose item) { using (LogContext.PushProperty("OperationId", Guid.NewGuid())) { Log.Debug("Removing screen {screenType}", item.WaitingItem.GetType()); RemoveItem(item.WaitingItem); while (true) { if (item.IsStillBusy == false) { break; } Log.Debug("Waiting to dispose screen {0}...", item.WaitingItem.GetType()); item.RecordAttempt(); if (item.HasReachedAttemptThreshold) { Log.Error("Screen {0} is still busy after 60 seconds. It will now be forcibly closed. This may result in subsequent errors being reported.", item.WaitingItem.GetType()); break; } await Task.Delay(TimeSpan.FromSeconds(1)); } Log.Debug("Disposing screen {0}.", item.WaitingItem.GetType()); DisposeItem(item.WaitingItem); } }
protected bool Equals(WaitingToClose other) { return(Equals(WaitingItem, other.WaitingItem)); }