Skip to content

Commit 1daebee

Browse files
committed
Undos formatting issues
1 parent 6678c50 commit 1daebee

File tree

1 file changed

+14
-27
lines changed

1 file changed

+14
-27
lines changed

src/Exceptionless/Queue/DefaultEventQueue.cs

Lines changed: 14 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public class DefaultEventQueue : IEventQueue {
2222
private DateTime? _suspendProcessingUntil;
2323
private DateTime? _discardQueuedItemsUntil;
2424

25-
public DefaultEventQueue(ExceptionlessConfiguration config, IExceptionlessLog log, ISubmissionClient client, IObjectStorage objectStorage, IJsonSerializer serializer) : this(config, log, client, objectStorage, serializer, null, null) { }
25+
public DefaultEventQueue(ExceptionlessConfiguration config, IExceptionlessLog log, ISubmissionClient client, IObjectStorage objectStorage, IJsonSerializer serializer): this(config, log, client, objectStorage, serializer, null, null) {}
2626

2727
public DefaultEventQueue(ExceptionlessConfiguration config, IExceptionlessLog log, ISubmissionClient client, IObjectStorage objectStorage, IJsonSerializer serializer, TimeSpan? processQueueInterval, TimeSpan? queueStartDelay) {
2828
_log = log;
@@ -86,52 +86,43 @@ public Task Process() {
8686
var response = _client.PostEvents(events, _config, _serializer);
8787
if (response.Success) {
8888
_log.FormattedInfo(typeof(DefaultEventQueue), "Sent {0} events to \"{1}\".", batch.Count, _config.ServerUrl);
89-
}
90-
else if (response.ServiceUnavailable) {
89+
} else if (response.ServiceUnavailable) {
9190
// You are currently over your rate limit or the servers are under stress.
9291
_log.Error(typeof(DefaultEventQueue), "Server returned service unavailable.");
9392
SuspendProcessing();
9493
deleteBatch = false;
95-
}
96-
else if (response.PaymentRequired) {
94+
} else if (response.PaymentRequired) {
9795
// If the organization over the rate limit then discard the event.
9896
_log.Warn(typeof(DefaultEventQueue), "Too many events have been submitted, please upgrade your plan.");
9997
SuspendProcessing(discardFutureQueuedItems: true, clearQueue: true);
100-
}
101-
else if (response.UnableToAuthenticate) {
98+
} else if (response.UnableToAuthenticate) {
10299
// The api key was suspended or could not be authorized.
103100
_log.Error(typeof(DefaultEventQueue), "Unable to authenticate, please check your configuration. The event will not be submitted.");
104101
SuspendProcessing(TimeSpan.FromMinutes(15));
105-
}
106-
else if (response.NotFound || response.BadRequest) {
102+
} else if (response.NotFound || response.BadRequest) {
107103
// The service end point could not be found.
108104
_log.FormattedError(typeof(DefaultEventQueue), "Error while trying to submit data: {0}", response.Message);
109105
SuspendProcessing(TimeSpan.FromHours(4));
110-
}
111-
else if (response.RequestEntityTooLarge) {
106+
} else if (response.RequestEntityTooLarge) {
112107
if (batchSize > 1) {
113108
_log.Error(typeof(DefaultEventQueue), "Event submission discarded for being too large. The event will be retried with a smaller batch size.");
114109
batchSize = Math.Max(1, (int)Math.Round(batchSize / 1.5d, 0));
115110
deleteBatch = false;
116-
}
117-
else {
111+
} else {
118112
_log.Error(typeof(DefaultEventQueue), "Event submission discarded for being too large. The event will not be submitted.");
119113
}
120-
}
121-
else if (!response.Success) {
114+
} else if (!response.Success) {
122115
_log.Error(typeof(DefaultEventQueue), String.Concat("An error occurred while submitting events: ", response.Message));
123116
SuspendProcessing();
124117
deleteBatch = false;
125118
}
126119

127120
OnEventsPosted(new EventsPostedEventArgs { Events = events, Response = response });
128-
}
129-
catch (AggregateException ex) {
121+
} catch (AggregateException ex) {
130122
_log.Error(typeof(DefaultEventQueue), ex, String.Concat("An error occurred while submitting events: ", ex.Flatten().Message));
131123
SuspendProcessing();
132124
deleteBatch = false;
133-
}
134-
catch (Exception ex) {
125+
} catch (Exception ex) {
135126
_log.Error(typeof(DefaultEventQueue), ex, String.Concat("An error occurred while submitting events: ", ex.Message));
136127
SuspendProcessing();
137128
deleteBatch = false;
@@ -147,12 +138,10 @@ public Task Process() {
147138

148139
batch = _storage.GetEventBatch(_config.GetQueueName(), _serializer, batchSize, maxCreatedDate);
149140
}
150-
}
151-
catch (Exception ex) {
141+
} catch (Exception ex) {
152142
_log.Error(typeof(DefaultEventQueue), ex, String.Concat("An error occurred while processing the queue: ", ex.Message));
153143
SuspendProcessing();
154-
}
155-
finally {
144+
} finally {
156145
tcs.SetResult(true);
157146
lock (sync) {
158147
_processingQueueTask = null;
@@ -188,8 +177,7 @@ public void SuspendProcessing(TimeSpan? duration = null, bool discardFutureQueue
188177
#pragma warning disable 4014
189178
_storage.CleanupQueueFiles(_config.GetQueueName(), TimeSpan.Zero);
190179
#pragma warning restore 4014
191-
}
192-
catch (Exception) { }
180+
} catch (Exception) { }
193181
}
194182

195183
public event EventHandler<EventsPostedEventArgs> EventsPosted;
@@ -198,8 +186,7 @@ protected virtual void OnEventsPosted(EventsPostedEventArgs e) {
198186
try {
199187
if (EventsPosted != null)
200188
EventsPosted.Invoke(this, e);
201-
}
202-
catch (Exception ex) {
189+
} catch (Exception ex) {
203190
_log.Error(typeof(DefaultEventQueue), ex, "Error while calling OnEventsPosted event handlers.");
204191
}
205192
}

0 commit comments

Comments
 (0)