mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-17 14:04:26 +01:00
Make sure websockets does not throw, fix annying warning of emails
This commit is contained in:
@@ -262,7 +262,7 @@ namespace BTCPayServer.Controllers
|
|||||||
{
|
{
|
||||||
await webSocket.SendAsync(DummyBuffer, WebSocketMessageType.Binary, true, cts.Token);
|
await webSocket.SendAsync(DummyBuffer, WebSocketMessageType.Binary, true, cts.Token);
|
||||||
}
|
}
|
||||||
catch { await CloseSocket(webSocket); }
|
catch { try { webSocket.Dispose(); } catch { } }
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async Task CloseSocket(WebSocket webSocket)
|
private static async Task CloseSocket(WebSocket webSocket)
|
||||||
@@ -277,7 +277,7 @@ namespace BTCPayServer.Controllers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
finally { webSocket.Dispose(); }
|
finally { try { webSocket.Dispose(); } catch { } }
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
using Hangfire;
|
using BTCPayServer.Logging;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Hangfire;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -20,10 +22,16 @@ namespace BTCPayServer.Services.Mails
|
|||||||
_JobClient = jobClient;
|
_JobClient = jobClient;
|
||||||
_Repository = repository;
|
_Repository = repository;
|
||||||
}
|
}
|
||||||
public Task SendEmailAsync(string email, string subject, string message)
|
public async Task SendEmailAsync(string email, string subject, string message)
|
||||||
{
|
{
|
||||||
|
var settings = await _Repository.GetSettingAsync<EmailSettings>();
|
||||||
|
if (settings == null)
|
||||||
|
{
|
||||||
|
Logs.Configuration.LogWarning("Should have sent email, but email settings are not configured");
|
||||||
|
return;
|
||||||
|
}
|
||||||
_JobClient.Schedule(() => SendMailCore(email, subject, message), TimeSpan.Zero);
|
_JobClient.Schedule(() => SendMailCore(email, subject, message), TimeSpan.Zero);
|
||||||
return Task.CompletedTask;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task SendMailCore(string email, string subject, string message)
|
public async Task SendMailCore(string email, string subject, string message)
|
||||||
|
|||||||
Reference in New Issue
Block a user