🐛 Serval bug fixes

This commit is contained in:
2025-07-17 14:24:30 +08:00
parent b14af43996
commit 4e2a7ebbce
12 changed files with 111 additions and 77 deletions

View File

@@ -40,7 +40,21 @@ public static class ServiceHelper
.CreateAccountServiceClient(etcdClient, clientCertPath, clientKeyPath, clientCertPassword)
.GetAwaiter()
.GetResult();
});
});
services.AddSingleton<ActionLogService.ActionLogServiceClient>(sp =>
{
var etcdClient = sp.GetRequiredService<IEtcdClient>();
var config = sp.GetRequiredService<IConfiguration>();
var clientCertPath = config["Service:ClientCert"]!;
var clientKeyPath = config["Service:ClientKey"]!;
var clientCertPassword = config["Service:CertPassword"];
return GrpcClientHelper
.CreateActionLogServiceClient(etcdClient, clientCertPath, clientKeyPath, clientCertPassword)
.GetAwaiter()
.GetResult();
});
return services;
}

View File

@@ -8,8 +8,12 @@ namespace DysonNetwork.Shared.Registry;
public class ServiceRegistry(IEtcdClient etcd, ILogger<ServiceRegistry> logger)
{
public async Task RegisterService(string serviceName, string serviceUrl, long leaseTtlSeconds = 60,
CancellationToken cancellationToken = default)
public async Task RegisterService(
string serviceName,
string serviceUrl,
long leaseTtlSeconds = 60,
CancellationToken cancellationToken = default
)
{
var key = $"/services/{serviceName}";
var leaseResponse = await etcd.LeaseGrantAsync(