logging most communication exceptions
This commit is contained in:
parent
d61d207fb8
commit
ef2ddd16bf
6 changed files with 80 additions and 40 deletions
17
.drone.yml
17
.drone.yml
|
@ -20,22 +20,25 @@ steps:
|
||||||
|
|
||||||
- name: zip
|
- name: zip
|
||||||
image: alpine:latest
|
image: alpine:latest
|
||||||
|
cwhen:
|
||||||
|
event:
|
||||||
|
- tag
|
||||||
volumes:
|
volumes:
|
||||||
- name: cache
|
- name: cache
|
||||||
path: /release
|
path: /release
|
||||||
commands:
|
commands:
|
||||||
- apk update
|
- apk update
|
||||||
- apk add zip
|
- apk add zip
|
||||||
- cd /release/net5.0/win-x64
|
|
||||||
- zip -r sledgemapper-win.zip ./publish
|
|
||||||
- mkdir /release/zip
|
- mkdir /release/zip
|
||||||
- cp sledgemapper-win.zip /release/zip
|
- cd /release/net5.0/win-x64
|
||||||
|
- zip -r sledgemapper-${DRONE_TAG}-win.zip ./publish
|
||||||
|
- cp sledgemapper-${DRONE_TAG}-win.zip /release/zip
|
||||||
- cd /release/net5.0/osx-x64
|
- cd /release/net5.0/osx-x64
|
||||||
- zip -r sledgemapper-osx.zip ./publish
|
- zip -r sledgemapper-${DRONE_TAG}-osx.zip ./publish
|
||||||
- cp sledgemapper-osx.zip /release/zip
|
- cp sledgemapper-${DRONE_TAG}-osx.zip /release/zip
|
||||||
- cd /release/net5.0/linux-x64
|
- cd /release/net5.0/linux-x64
|
||||||
- zip -r sledgemapper-linux.zip ./publish
|
- zip -r sledgemapper-${DRONE_TAG}-linux.zip ./publish
|
||||||
- cp sledgemapper-linux.zip /release/zip
|
- cp sledgemapper-${DRONE_TAG}-linux.zip /release/zip
|
||||||
|
|
||||||
- name: gitea_release
|
- name: gitea_release
|
||||||
image: plugins/gitea-release
|
image: plugins/gitea-release
|
||||||
|
|
|
@ -1,40 +1,50 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Threading.Channels;
|
using System.Threading.Channels;
|
||||||
|
using Exceptionless;
|
||||||
|
using Exceptionless.Models;
|
||||||
|
|
||||||
namespace Sledgemapper
|
namespace Sledgemapper
|
||||||
{
|
{
|
||||||
public class ChannelsQueue
|
public class ChannelsQueue
|
||||||
{
|
|
||||||
private readonly ChannelWriter<Action> _writer;
|
|
||||||
|
|
||||||
public ChannelsQueue()
|
|
||||||
{
|
{
|
||||||
var channel = Channel.CreateUnbounded<Action>(new UnboundedChannelOptions() { SingleReader = true });
|
private readonly ChannelWriter<Action> _writer;
|
||||||
var reader = channel.Reader;
|
|
||||||
_writer = channel.Writer;
|
public ChannelsQueue()
|
||||||
|
{
|
||||||
Task.Run(async () =>
|
var channel = Channel.CreateUnbounded<Action>(new UnboundedChannelOptions() { SingleReader = true });
|
||||||
{
|
var reader = channel.Reader;
|
||||||
while (await reader.WaitToReadAsync())
|
_writer = channel.Writer;
|
||||||
|
|
||||||
|
Task.Run(async () =>
|
||||||
{
|
{
|
||||||
|
while (await reader.WaitToReadAsync())
|
||||||
|
{
|
||||||
// Fast loop around available jobs
|
// Fast loop around available jobs
|
||||||
while (reader.TryRead(out var job))
|
while (reader.TryRead(out var job))
|
||||||
{
|
{
|
||||||
job.Invoke();
|
try
|
||||||
|
{
|
||||||
|
job.Invoke();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
ExceptionlessClient.Default.SubmitException(ex);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
}
|
|
||||||
|
public void Enqueue(Action job)
|
||||||
public void Enqueue(Action job)
|
{
|
||||||
{
|
_writer.TryWrite(job);
|
||||||
_writer.TryWrite(job);
|
}
|
||||||
}
|
|
||||||
|
public void Stop()
|
||||||
public void Stop()
|
{
|
||||||
{
|
_writer.Complete();
|
||||||
_writer.Complete();
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -166,6 +166,7 @@ namespace Sledgemapper
|
||||||
{
|
{
|
||||||
await Policy
|
await Policy
|
||||||
.Handle<ApiException>(ex => ex.StatusCode == HttpStatusCode.RequestTimeout)
|
.Handle<ApiException>(ex => ex.StatusCode == HttpStatusCode.RequestTimeout)
|
||||||
|
|
||||||
.RetryForeverAsync()
|
.RetryForeverAsync()
|
||||||
//.RetryAsync(Polly.RetrySyntax., async (exception, retryCount) => await Task.Delay(500))
|
//.RetryAsync(Polly.RetrySyntax., async (exception, retryCount) => await Task.Delay(500))
|
||||||
.ExecuteAsync(async () => await call().ConfigureAwait(false))
|
.ExecuteAsync(async () => await call().ConfigureAwait(false))
|
||||||
|
|
|
@ -8,8 +8,14 @@ namespace Sledgemapper
|
||||||
[STAThread]
|
[STAThread]
|
||||||
static void Main()
|
static void Main()
|
||||||
{
|
{
|
||||||
ExceptionlessClient.Default.Configuration.ServerUrl="https://exceptionless.michelescandura.com";
|
ExceptionlessClient.Default.Configuration.ServerUrl = "https://exceptionless.michelescandura.com";
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
ExceptionlessClient.Default.Startup("Qvdn6odZRJyGNnorjayMkiwjVsnAK3rNkFtn9bvL");
|
||||||
|
#else
|
||||||
ExceptionlessClient.Default.Startup("uprV1LocxAlUPPC9oB4eOlt8jGZ5WypMZKdJCsdL");
|
ExceptionlessClient.Default.Startup("uprV1LocxAlUPPC9oB4eOlt8jGZ5WypMZKdJCsdL");
|
||||||
|
#endif
|
||||||
|
|
||||||
using (var game = new Sledgemapper())
|
using (var game = new Sledgemapper())
|
||||||
game.Run();
|
game.Run();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
using System;
|
||||||
|
using Exceptionless;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
|
|
||||||
namespace Sledgemapper
|
namespace Sledgemapper
|
||||||
|
@ -8,13 +10,24 @@ namespace Sledgemapper
|
||||||
public Color OverlayTintColor { get; set; }
|
public Color OverlayTintColor { get; set; }
|
||||||
public Color GridColor { get; set; }
|
public Color GridColor { get; set; }
|
||||||
public Color NoteColor { get; set; }
|
public Color NoteColor { get; set; }
|
||||||
|
public string MachineName { get; set; }
|
||||||
|
|
||||||
public Settings()
|
public Settings()
|
||||||
{
|
{
|
||||||
BackgroundColor=Color.LightGray;
|
BackgroundColor = Color.LightGray;
|
||||||
GridColor=Color.Black;
|
GridColor = Color.Black;
|
||||||
NoteColor=Color.DarkRed;
|
NoteColor = Color.DarkRed;
|
||||||
OverlayTintColor = new Color(24, 118, 157);
|
OverlayTintColor = new Color(24, 118, 157);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
MachineName = Environment.MachineName;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
ExceptionlessClient.Default.SubmitException(ex);
|
||||||
|
MachineName = "n/a";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,25 +65,28 @@ namespace Sledgemapper
|
||||||
|
|
||||||
private async Task OnHubDisconnected(Exception arg)
|
private async Task OnHubDisconnected(Exception arg)
|
||||||
{
|
{
|
||||||
|
ExceptionlessClient.Default.SubmitEvent(new Event { Message = "Hub disconnected", Type = "SignalR Client Events", Source = _settings.MachineName });
|
||||||
_mainWidget.lblConnectionStatus.Text = "Disconnected";
|
_mainWidget.lblConnectionStatus.Text = "Disconnected";
|
||||||
await Task.Yield();
|
await Task.Yield();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task OnHubReconnecting(Exception arg)
|
private async Task OnHubReconnecting(Exception arg)
|
||||||
{
|
{
|
||||||
|
ExceptionlessClient.Default.SubmitEvent(new Event { Message = "Reconnecting Hub", Type = "SignalR Client Events", Source = _settings.MachineName });
|
||||||
_mainWidget.lblConnectionStatus.Text = "Reconnecting";
|
_mainWidget.lblConnectionStatus.Text = "Reconnecting";
|
||||||
await Task.Yield();
|
await Task.Yield();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task OnHubReconnected(string arg)
|
private async Task OnHubReconnected(string arg)
|
||||||
{
|
{
|
||||||
|
ExceptionlessClient.Default.SubmitEvent(new Event { Message = "Hub reconnected", Type = "SignalR Client Events", Source = _settings.MachineName });
|
||||||
_mainWidget.lblConnectionStatus.Text = "Connected";
|
_mainWidget.lblConnectionStatus.Text = "Connected";
|
||||||
await Task.Yield();
|
await Task.Yield();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Initialize()
|
protected override void Initialize()
|
||||||
{
|
{
|
||||||
ExceptionlessClient.Default.SubmitEvent(new Event { Message = "Initialize", Type = "AppLifecycle", Source = "Fuel System" });
|
ExceptionlessClient.Default.SubmitEvent(new Event { Message = "Initialize", Type = "AppLifecycle", Source = _settings.MachineName });
|
||||||
IsMouseVisible = true;
|
IsMouseVisible = true;
|
||||||
Window.AllowUserResizing = true;
|
Window.AllowUserResizing = true;
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
@ -894,7 +897,7 @@ namespace Sledgemapper
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine(ex.Message);
|
ExceptionlessClient.Default.SubmitException(ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (successful)
|
if (successful)
|
||||||
|
@ -1009,11 +1012,13 @@ namespace Sledgemapper
|
||||||
}
|
}
|
||||||
catch (Refit.ApiException refitException)
|
catch (Refit.ApiException refitException)
|
||||||
{
|
{
|
||||||
|
ExceptionlessClient.Default.SubmitException(refitException);
|
||||||
localContent.LblLoginError.Text = refitException.Content;
|
localContent.LblLoginError.Text = refitException.Content;
|
||||||
localContent.LblLoginError.Visible = true;
|
localContent.LblLoginError.Visible = true;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
ExceptionlessClient.Default.SubmitException(ex);
|
||||||
localContent.LblLoginError.Text = "Can't connect to the server";
|
localContent.LblLoginError.Text = "Can't connect to the server";
|
||||||
localContent.LblLoginError.Visible = true;
|
localContent.LblLoginError.Visible = true;
|
||||||
Debug.Write(ex);
|
Debug.Write(ex);
|
||||||
|
@ -1096,11 +1101,13 @@ namespace Sledgemapper
|
||||||
}
|
}
|
||||||
catch (Refit.ApiException refitException)
|
catch (Refit.ApiException refitException)
|
||||||
{
|
{
|
||||||
|
ExceptionlessClient.Default.SubmitException(refitException);
|
||||||
localContent.LblLoginError.Text = refitException.Content;
|
localContent.LblLoginError.Text = refitException.Content;
|
||||||
localContent.LblLoginError.Visible = true;
|
localContent.LblLoginError.Visible = true;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
ExceptionlessClient.Default.SubmitException(ex);
|
||||||
localContent.LblLoginError.Text = "Can't connect to the server";
|
localContent.LblLoginError.Text = "Can't connect to the server";
|
||||||
localContent.LblLoginError.Visible = true;
|
localContent.LblLoginError.Visible = true;
|
||||||
Debug.Write(ex);
|
Debug.Write(ex);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue