remove the heartbeat history configuration for a window
This commit is contained in:
@@ -1,6 +0,0 @@
|
||||
namespace SafelyYou.Config;
|
||||
|
||||
public class HeartBeatHistoryConfig
|
||||
{
|
||||
public TimeSpan Window { get; set; }
|
||||
}
|
||||
@@ -16,12 +16,14 @@ public sealed class KnownDevices
|
||||
|
||||
public sealed class DeviceHeartBeatHistory
|
||||
{
|
||||
|
||||
public enum AddResult { Added, OutOfSequence }
|
||||
|
||||
public long NumberOfHeartBeats { get; private set; }
|
||||
public DateTimeOffset? FirstHeartBeat { get; private set; }
|
||||
public DateTimeOffset? LastHeartBeat { get; private set; }
|
||||
|
||||
|
||||
public AddResult Add(DateTimeOffset sentAt)
|
||||
{
|
||||
// Reject heartbeats that arrive before the latest registered time.
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using SafelyYou;
|
||||
using SafelyYou.Api;
|
||||
using SafelyYou.Config;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
@@ -14,12 +13,6 @@ builder.Services.AddSingleton<KnownDevices>(_ =>
|
||||
return new KnownDevices(deviceIds);
|
||||
});
|
||||
|
||||
builder.Services.AddSingleton<HeartBeatHistoryConfig>(_ =>
|
||||
{
|
||||
var millis = builder.Configuration.GetSection("HeartBeatHistory").GetValue<int>("WindowMillis");
|
||||
return new HeartBeatHistoryConfig() { Window = TimeSpan.FromMilliseconds(millis) };
|
||||
});
|
||||
|
||||
builder.Services.AddSingleton<HeartBeatHistories>();
|
||||
builder.Services.AddSingleton<UploadTimes>();
|
||||
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
{
|
||||
"HeartBeatHistory" : {
|
||||
"WindowMillis" : 1000
|
||||
},
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
|
||||
Reference in New Issue
Block a user