Skip to content

Commit 4e2b30d

Browse files
committed
Updated shutdown handlers to call ProcessQueue before submit session end
Submitting any existing events is more important than blocking to send a single session end.
1 parent 249be4e commit 4e2b30d

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

Source/Platforms/Console/ExceptionlessExtensions.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,17 @@ public static void Register(this ExceptionlessClient client) {
2626
public static void Unregister(this ExceptionlessClient client) {
2727
client.Shutdown();
2828
client.UnregisterOnProcessExitHandler();
29+
30+
client.ProcessQueue();
2931
if (client.Configuration.SessionsEnabled)
3032
client.SubmitSessionEnd();
31-
client.ProcessQueue();
3233
}
3334

3435
private static void RegisterOnProcessExitHandler(this ExceptionlessClient client) {
3536
if (_onProcessExit == null) {
3637
_onProcessExit = (sender, args) => {
37-
client.SubmitSessionEnd();
3838
client.ProcessQueue();
39+
client.SubmitSessionEnd();
3940
};
4041
}
4142

Source/Platforms/Windows/ExceptionlessWindowsExtensions.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ public static void Unregister(this ExceptionlessClient client) {
4444
client.UnregisterOnProcessExitHandler();
4545

4646
client.SubmittingEvent -= OnSubmittingEvent;
47-
47+
48+
client.ProcessQueue();
4849
if (client.Configuration.SessionsEnabled)
4950
client.SubmitSessionEnd();
50-
client.ProcessQueue();
5151
}
5252

5353
private static void OnSubmittingEvent(object sender, EventSubmittingEventArgs e) {
@@ -63,10 +63,10 @@ private static void OnSubmittingEvent(object sender, EventSubmittingEventArgs e)
6363
private static void RegisterOnProcessExitHandler(this ExceptionlessClient client) {
6464
if (_onProcessExit == null) {
6565
_onProcessExit = (sender, args) => {
66+
client.ProcessQueue();
67+
6668
if (client.Configuration.SessionsEnabled)
6769
client.SubmitSessionEnd();
68-
69-
client.ProcessQueue();
7070
};
7171
}
7272

Source/Platforms/Wpf/ExceptionlessWpfExtensions.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ public static void Unregister(this ExceptionlessClient client) {
4747
client.UnregisterOnProcessExitHandler();
4848

4949
client.SubmittingEvent -= OnSubmittingEvent;
50-
51-
client.SubmitSessionEnd();
50+
5251
client.ProcessQueue();
52+
client.SubmitSessionEnd();
5353
}
5454

5555
private static void OnSubmittingEvent(object sender, EventSubmittingEventArgs e) {
@@ -72,10 +72,10 @@ private static bool ShowDialog(EventSubmittingEventArgs e) {
7272
private static void RegisterOnProcessExitHandler(this ExceptionlessClient client) {
7373
if (_onProcessExit == null) {
7474
_onProcessExit = (sender, args) => {
75+
client.ProcessQueue();
76+
7577
if (client.Configuration.SessionsEnabled)
7678
client.SubmitSessionEnd();
77-
78-
client.ProcessQueue();
7979
};
8080
}
8181

0 commit comments

Comments
 (0)