private LongPollServerHistory GetLongPoolHistory() { if (!Ts.HasValue) { GetLongPoolServer(); } LongPollServerResponse rp = new LongPollServerResponse(); rp.Response = new ServerHistoryResponse(); if (Ts != null) { rp.Response.Ts = Ts.Value; } rp.Response.Pts = Pts; rp.Response.Server = Server; rp.Response.Key = Key; int c = 0; LongPollServerHistory history = null; string errorLog = ""; while (c < 5 && history == null) { c++; try { history = _account.GetLongPollHistory(rp); } catch (TooManyRequestsException) { Thread.Sleep(150); c--; } catch (Exception ex) { errorLog += string.Format("{0} - {1}{2}", c, ex.Message, Environment.NewLine); } } if (history != null) { Ts = history.Ts; } else { throw new NotImplementedException(errorLog); } return(history); }