wabbajack/Wabbajack.Server/Controllers/Heartbeat.cs

36 lines
854 B
C#
Raw Normal View History

using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Wabbajack.Server;
using Wabbajack.Server.DTOs;
using Wabbajack.Server.Services;
2021-10-23 16:51:17 +00:00
namespace Wabbajack.BuildServer.Controllers;
2021-10-23 16:51:17 +00:00
[Route("/heartbeat")]
public class Heartbeat : ControllerBase
{
private static readonly DateTime _startTime;
2021-10-23 16:51:17 +00:00
private readonly GlobalInformation _globalInformation;
static Heartbeat()
{
_startTime = DateTime.Now;
}
2021-11-27 18:31:35 +00:00
public Heartbeat(ILogger<Heartbeat> logger, GlobalInformation globalInformation,
2021-10-23 16:51:17 +00:00
QuickSync quickSync)
{
_globalInformation = globalInformation;
}
[HttpGet]
public async Task<IActionResult> GetHeartbeat()
{
return Ok(new HeartbeatResult
{
Uptime = DateTime.Now - _startTime,
});
}
}