in src/lease.ts [214:234]
public keepaliveOnce(
options: grpc.CallOptions | undefined = this.defaultOptions,
): Promise<RPC.ILeaseKeepAliveResponse> {
return Promise.all([this.client.leaseKeepAlive(options), this.grant()]).then(([stream, id]) => {
return new Promise<RPC.ILeaseKeepAliveResponse>((resolve, reject) => {
stream.on('data', resolve);
stream.on('error', err => reject(castGrpcError(err)));
stream.write({ ID: id });
}).then(res => {
stream.end();
if (leaseExpired(res)) {
const err = new EtcdLeaseInvalidError(res.ID);
this.emitLoss(err);
throw err;
}
this.lastKeepAlive = Date.now();
return res;
});
});
}