2020-05-09 05:12:51 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
using Wabbajack.Server;
|
|
|
|
|
using Wabbajack.Server.DTOs;
|
2020-11-19 22:56:30 +00:00
|
|
|
|
using Wabbajack.Server.Services;
|
2020-05-09 05:12:51 +00:00
|
|
|
|
|
2021-10-23 16:51:17 +00:00
|
|
|
|
namespace Wabbajack.BuildServer.Controllers;
|
2020-05-09 05:12:51 +00:00
|
|
|
|
|
2021-10-23 16:51:17 +00:00
|
|
|
|
[Route("/heartbeat")]
|
|
|
|
|
public class Heartbeat : ControllerBase
|
|
|
|
|
{
|
|
|
|
|
private static readonly DateTime _startTime;
|
2020-05-09 05:12:51 +00:00
|
|
|
|
|
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,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|