mirror of
https://github.com/bitwarden/server
synced 2026-01-10 12:33:49 +00:00
32 lines
976 B
C#
32 lines
976 B
C#
using System.Net.Http;
|
|
using System.Threading.Tasks;
|
|
using Bit.Core;
|
|
using Bit.Core.Jobs;
|
|
using Microsoft.Extensions.Logging;
|
|
using Quartz;
|
|
|
|
namespace Bit.Admin.Jobs
|
|
{
|
|
public class AliveJob : BaseJob
|
|
{
|
|
private readonly GlobalSettings _globalSettings;
|
|
private HttpClient _httpClient = new HttpClient();
|
|
|
|
public AliveJob(
|
|
GlobalSettings globalSettings,
|
|
ILogger<AliveJob> logger)
|
|
: base(logger)
|
|
{
|
|
_globalSettings = globalSettings;
|
|
}
|
|
|
|
protected async override Task ExecuteJobAsync(IJobExecutionContext context)
|
|
{
|
|
_logger.LogInformation(Constants.BypassFiltersEventId, "Execute job task: Keep alive");
|
|
var response = await _httpClient.GetAsync(_globalSettings.BaseServiceUri.Admin);
|
|
_logger.LogInformation(Constants.BypassFiltersEventId, "Finished job task: Keep alive, " +
|
|
response.StatusCode);
|
|
}
|
|
}
|
|
}
|