in client/Apache.ShenYu.Client/Utils/Etcd/EtcdClientUtils.cs [64:88]
private void InitLease(EtcdOptions options)
{
try
{
// create rent id to bind
var response = this._client.LeaseGrant(new Etcdserverpb.LeaseGrantRequest()
{
TTL = options.TTL
});
this._globalLeaseId = response.ID;
var tokenSource = new CancellationTokenSource();
this._client.LeaseKeepAlive(this._globalLeaseId, tokenSource.Token);
//this._client.LeaseKeepAlive(new LeaseKeepAliveRequest()
//{
// ID = _globalLeaseId
//}, (x) =>
//{
// Console.WriteLine(x.ID);
//}, tokenSource.Token, _metadata);
}
catch (Exception ex)
{
_logger.LogError("Init Lease error", ex);
}
}