mirror of https://github.com/Squidex/squidex.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.3 KiB
38 lines
1.3 KiB
// ==========================================================================
|
|
// Squidex Headless CMS
|
|
// ==========================================================================
|
|
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
|
// All rights reserved. Licensed under the MIT license.
|
|
// ==========================================================================
|
|
|
|
using System.Collections.Generic;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using EventStore.ClientAPI;
|
|
|
|
namespace Squidex.Infrastructure.Diagnostics
|
|
{
|
|
public sealed class GetEventStoreHealthCheck : IHealthCheck
|
|
{
|
|
private readonly IEventStoreConnection connection;
|
|
|
|
public IEnumerable<string> Scopes
|
|
{
|
|
get { yield return HealthCheckScopes.Node; }
|
|
}
|
|
|
|
public GetEventStoreHealthCheck(IEventStoreConnection connection)
|
|
{
|
|
Guard.NotNull(connection, nameof(connection));
|
|
|
|
this.connection = connection;
|
|
}
|
|
|
|
public async Task<HealthCheckResult> CheckHealthAsync(CancellationToken cancellationToken = default(CancellationToken))
|
|
{
|
|
await connection.ReadEventAsync("test", 1, false);
|
|
|
|
return new HealthCheckResult(true, "Querying test event from event store.");
|
|
}
|
|
}
|
|
}
|
|
|