зеркало из https://github.com/microsoft/etcd3.git
fix: leases revoked or released before grant completes leaking
This commit is contained in:
Родитель
c296d0337b
Коммит
5c66c0d6b6
|
@ -1,5 +1,9 @@
|
|||
# Changelog
|
||||
|
||||
## TBA
|
||||
|
||||
- **fix:** leases revoked or released before grant completes leaking
|
||||
|
||||
## 1.1.0 2020-11-28
|
||||
|
||||
- **feat:** implement elections
|
||||
|
|
|
@ -133,6 +133,10 @@ export class Lease extends EventEmitter {
|
|||
this.leaseID = this.client
|
||||
.leaseGrant({ TTL: ttl }, options)
|
||||
.then(res => {
|
||||
if (this.innerState === LeaseState.Revoked) {
|
||||
return res.ID;
|
||||
}
|
||||
|
||||
this.innerState = LeaseState.Alive;
|
||||
this.lastKeepAlive = Date.now();
|
||||
if (autoKeepAlive !== false) {
|
||||
|
|
|
@ -189,7 +189,7 @@ describe('election', () => {
|
|||
]);
|
||||
|
||||
expect(newLeader).to.equal('candidate');
|
||||
campaign2.resign();
|
||||
await campaign2.resign();
|
||||
await observer.cancel();
|
||||
});
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче