private void RefreshQuotaIfNeeded() { if (!IsRefreshNeeded()) return; lock (SynchRoot) { if (IsRefreshNeeded())//Double check { _log.DebugFormat("refreshing qouta. interval: {0} Last refresh was at: {1}", RefreshTimeout, _lastRefresh); //Do quota refresh _lastRefresh = DateTime.UtcNow.AddMinutes(1); try { var quotaRequest = new GetSendQuotaRequest(); _quota = _emailService.GetSendQuota(quotaRequest).GetSendQuotaResult; _sendWindow = TimeSpan.FromSeconds(1.0 / _quota.MaxSendRate); _log.DebugFormat("quota: {0}/{1} at {2} mps. send window:{3}", _quota.SentLast24Hours, _quota.Max24HourSend, _quota.MaxSendRate, _sendWindow); } catch (Exception e) { _log.Error("error refreshing quota", e); } } } }
private void RefreshQuotaIfNeeded() { if (!IsRefreshNeeded()) return; lock (locker) { if (IsRefreshNeeded())//Double check { log.DebugFormat("refreshing qouta. interval: {0} Last refresh was at: {1}", refreshTimeout, lastRefresh); //Do quota refresh lastRefresh = DateTime.UtcNow.AddMinutes(1); try { var r = new GetSendQuotaRequest(); quota = ses.GetSendQuota(r).GetSendQuotaResult; sendWindow = TimeSpan.FromSeconds(1.0 / quota.MaxSendRate); log.DebugFormat("quota: {0}/{1} at {2} mps. send window:{3}", quota.SentLast24Hours, quota.Max24HourSend, quota.MaxSendRate, sendWindow); } catch (Exception e) { log.Error("error refreshing quota", e); } } } }
protected void Page_Load(object sender, EventArgs e) { r = Utility.getSESUtils().getQuota(); }