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
|
||||
image: alpine:latest
|
||||
cwhen:
|
||||
event:
|
||||
- tag
|
||||
volumes:
|
||||
- name: cache
|
||||
path: /release
|
||||
commands:
|
||||
- apk update
|
||||
- apk add zip
|
||||
- cd /release/net5.0/win-x64
|
||||
- zip -r sledgemapper-win.zip ./publish
|
||||
- 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
|
||||
- zip -r sledgemapper-osx.zip ./publish
|
||||
- cp sledgemapper-osx.zip /release/zip
|
||||
- zip -r sledgemapper-${DRONE_TAG}-osx.zip ./publish
|
||||
- cp sledgemapper-${DRONE_TAG}-osx.zip /release/zip
|
||||
- cd /release/net5.0/linux-x64
|
||||
- zip -r sledgemapper-linux.zip ./publish
|
||||
- cp sledgemapper-linux.zip /release/zip
|
||||
- zip -r sledgemapper-${DRONE_TAG}-linux.zip ./publish
|
||||
- cp sledgemapper-${DRONE_TAG}-linux.zip /release/zip
|
||||
|
||||
- name: gitea_release
|
||||
image: plugins/gitea-release
|
||||
|
|
|
@ -1,40 +1,50 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading.Channels;
|
||||
using Exceptionless;
|
||||
using Exceptionless.Models;
|
||||
|
||||
namespace Sledgemapper
|
||||
{
|
||||
public class ChannelsQueue
|
||||
{
|
||||
private readonly ChannelWriter<Action> _writer;
|
||||
|
||||
public ChannelsQueue()
|
||||
public class ChannelsQueue
|
||||
{
|
||||
var channel = Channel.CreateUnbounded<Action>(new UnboundedChannelOptions() { SingleReader = true });
|
||||
var reader = channel.Reader;
|
||||
_writer = channel.Writer;
|
||||
|
||||
Task.Run(async () =>
|
||||
{
|
||||
while (await reader.WaitToReadAsync())
|
||||
private readonly ChannelWriter<Action> _writer;
|
||||
|
||||
public ChannelsQueue()
|
||||
{
|
||||
var channel = Channel.CreateUnbounded<Action>(new UnboundedChannelOptions() { SingleReader = true });
|
||||
var reader = channel.Reader;
|
||||
_writer = channel.Writer;
|
||||
|
||||
Task.Run(async () =>
|
||||
{
|
||||
while (await reader.WaitToReadAsync())
|
||||
{
|
||||
// Fast loop around available jobs
|
||||
while (reader.TryRead(out var job))
|
||||
{
|
||||
job.Invoke();
|
||||
{
|
||||
try
|
||||
{
|
||||
job.Invoke();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ExceptionlessClient.Default.SubmitException(ex);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void Enqueue(Action job)
|
||||
{
|
||||
_writer.TryWrite(job);
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
_writer.Complete();
|
||||
});
|
||||
}
|
||||
|
||||
public void Enqueue(Action job)
|
||||
{
|
||||
_writer.TryWrite(job);
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
_writer.Complete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -166,6 +166,7 @@ namespace Sledgemapper
|
|||
{
|
||||
await Policy
|
||||
.Handle<ApiException>(ex => ex.StatusCode == HttpStatusCode.RequestTimeout)
|
||||
|
||||
.RetryForeverAsync()
|
||||
//.RetryAsync(Polly.RetrySyntax., async (exception, retryCount) => await Task.Delay(500))
|
||||
.ExecuteAsync(async () => await call().ConfigureAwait(false))
|
||||
|
|
|
@ -8,8 +8,14 @@ namespace Sledgemapper
|
|||
[STAThread]
|
||||
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");
|
||||
#endif
|
||||
|
||||
using (var game = new Sledgemapper())
|
||||
game.Run();
|
||||
}
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
using System;
|
||||
using Exceptionless;
|
||||
using Microsoft.Xna.Framework;
|
||||
|
||||
namespace Sledgemapper
|
||||
|
@ -8,13 +10,24 @@ namespace Sledgemapper
|
|||
public Color OverlayTintColor { get; set; }
|
||||
public Color GridColor { get; set; }
|
||||
public Color NoteColor { get; set; }
|
||||
public string MachineName { get; set; }
|
||||
|
||||
public Settings()
|
||||
{
|
||||
BackgroundColor=Color.LightGray;
|
||||
GridColor=Color.Black;
|
||||
NoteColor=Color.DarkRed;
|
||||
BackgroundColor = Color.LightGray;
|
||||
GridColor = Color.Black;
|
||||
NoteColor = Color.DarkRed;
|
||||
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)
|
||||
{
|
||||
ExceptionlessClient.Default.SubmitEvent(new Event { Message = "Hub disconnected", Type = "SignalR Client Events", Source = _settings.MachineName });
|
||||
_mainWidget.lblConnectionStatus.Text = "Disconnected";
|
||||
await Task.Yield();
|
||||
}
|
||||
|
||||
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";
|
||||
await Task.Yield();
|
||||
}
|
||||
|
||||
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";
|
||||
await Task.Yield();
|
||||
}
|
||||
|
||||
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;
|
||||
Window.AllowUserResizing = true;
|
||||
base.Initialize();
|
||||
|
@ -894,7 +897,7 @@ namespace Sledgemapper
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
ExceptionlessClient.Default.SubmitException(ex);
|
||||
}
|
||||
|
||||
if (successful)
|
||||
|
@ -1009,11 +1012,13 @@ namespace Sledgemapper
|
|||
}
|
||||
catch (Refit.ApiException refitException)
|
||||
{
|
||||
ExceptionlessClient.Default.SubmitException(refitException);
|
||||
localContent.LblLoginError.Text = refitException.Content;
|
||||
localContent.LblLoginError.Visible = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ExceptionlessClient.Default.SubmitException(ex);
|
||||
localContent.LblLoginError.Text = "Can't connect to the server";
|
||||
localContent.LblLoginError.Visible = true;
|
||||
Debug.Write(ex);
|
||||
|
@ -1096,11 +1101,13 @@ namespace Sledgemapper
|
|||
}
|
||||
catch (Refit.ApiException refitException)
|
||||
{
|
||||
ExceptionlessClient.Default.SubmitException(refitException);
|
||||
localContent.LblLoginError.Text = refitException.Content;
|
||||
localContent.LblLoginError.Visible = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ExceptionlessClient.Default.SubmitException(ex);
|
||||
localContent.LblLoginError.Text = "Can't connect to the server";
|
||||
localContent.LblLoginError.Visible = true;
|
||||
Debug.Write(ex);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue