Skip to content

Commit

Permalink
remove ping until it is supported in pluggable
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliver Tomlinson committed Jul 29, 2023
1 parent 204ba92 commit bc1a5f8
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 22 deletions.
11 changes: 1 addition & 10 deletions src/Services/Services.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

namespace DaprComponents.Services;

public class StateStoreService : IStateStore, IPluggableComponentFeatures, ITransactionalStateStore, IPluggableComponentLiveness
public class StateStoreService : IStateStore, IPluggableComponentFeatures, ITransactionalStateStore
{
private readonly string _instanceId;
private readonly ILogger<StateStoreService> _logger;
Expand Down Expand Up @@ -169,15 +169,6 @@ await op.Visit(
}
}

public async Task PingAsync(CancellationToken cancellationToken = default)
{
using (_logger.BeginNamedScope("Ping", ( "DaprInstanceId", _instanceId)))
{
_logger.LogInformation("Pinging postgres...");
await _stateStoreInitHelper.PerformDatabaseProbeAsync();
}
}

private int GetTTLfromOperationMetadata(IReadOnlyDictionary<string,string> metadata)
{
if (metadata.TryGetValue("ttlInSeconds", out string ttl))
Expand Down
12 changes: 0 additions & 12 deletions src/StateStoreInitHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,6 @@ Why is this a func?
};
}

public async Task PerformDatabaseProbeAsync()
{
var connection = new NpgsqlConnection(_connectionString);
await connection.OpenAsync();
await using (var cmd = new NpgsqlCommand("SELECT 1", connection))
{
await using (var reader = await cmd.ExecuteReaderAsync())
{ }
}
await connection.CloseAsync();
}

public async Task<(Func<IReadOnlyDictionary<string,string>, Pgsql>, NpgsqlConnection)> GetDbFactory()
{
var connection = new NpgsqlConnection(_connectionString);
Expand Down

0 comments on commit bc1a5f8

Please sign in to comment.