Comments (5)
Thanks for the request, this will be fixed in v0.2.10
from etcd3.
is this fixed now? I'm having a similar problem.
const builder = ttl ? this.client.lease(ttl) : this.client;
return this.client
.if(key, 'Create', '==', 0)
.then(builder.put(key).value(value))
.else(this.client.get(key))
.commit();
So this code creates the lease. But unless I restart my app (or reload), the key won't be deleted. I mean, with TTlL=2 it just keeps the key alive and I can read it using etcdctl even after several seconds.
However, as soon as I quit the app or reload the "browser" window (this is an electron app), the key gets removed.
Am I doing something wrong? I can use a setTimeout to explicitly revoke() the lease after X seconds, but this should be automatic, right?.
from etcd3.
You should call builder.if
rather than this.client.if
to start the chain
from etcd3.
@gtamas i got the same issue to fix create lease like this
const lease = client.lease(2, {
autoKeepAlive: false
});
by default lease is kept alive using setInterval internally
https://github.com/microsoft/etcd3/blob/4b92eed/src/lease.ts#L73
from etcd3.
If I put lease ttl to 1 sec and autoKeepAlive :false
and sleep my test for 3 sec only then the lease expires it should expires in 1 sec or is it expected behaviour?
from etcd3.
Related Issues (20)
- WatchBuilder.create() doesn't reject an error when erred
- Waiting two ttl-periods before declaring a lease lost seems wrong
- When a timeout is happens the node process is hanging and not finalized.
- Need a way to alter the hosts/endpoints at runtime? HOT 1
- Election example from doc elects 2 leaders after etcd restart, starts multiple workers, or fails to elect a leader HOT 3
- How to specify limit and offset? HOT 1
- ./node_modules/@grpc/grpc-js/build/src/server.js Module not found: Can't resolve 'http2' in 'node_modules/@grpc/grpc-js/build/src' HOT 1
- GRPCUnavailableError:UNAVAILABLE: No connection established HOT 1
- This library has no debug or verbose options.
- Set host:port in the source code HOT 2
- Best way to `getAll(keys)`? HOT 1
- Elections probably choose more than one leader HOT 1
- Deadlock when EtcdInvalidAuthTokenError HOT 2
- pkg was pack success, but crash in use pack file, error for rpc.proto file path HOT 1
- Send custom header along with requests
- Lease expiration does not fire delete event HOT 1
- ILeaseTimeToLiveResponse returns an empty array of keys
- break in nodejs v14 HOT 3
- Updates to the repository and fixes but no release HOT 3
- getAll() / MultiRangeBuilder not available under SoftwareTransaction
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from etcd3.