Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

message TTL not expire with inmemory storage provider #361

Closed
cravler opened this issue Feb 1, 2021 · 2 comments
Closed

message TTL not expire with inmemory storage provider #361

cravler opened this issue Feb 1, 2021 · 2 comments
Labels

Comments

@cravler
Copy link
Contributor

cravler commented Feb 1, 2021

app.js

var client = require('emitter-io').connect({ host: '127.0.0.1', username: 'emitter-io' });

const key = '<key>';
const channel = 'demo';

if (process.argv.includes('--pub')) {

    client.publish({ key, channel, message: 'hello, emitter! ' + (new Date()).toISOString(), ttl: 10 });
    client.disconnect();

}

if (process.argv.includes('--sub')) {

    client.subscribe({ key, channel, last: 5 });
    client.on('message', msg => {
        console.log('>>> message: ', msg.channel, msg.asString());
    });

}

just run:

docker run -d --name emitter -p 8080:8080 -e EMITTER_LICENSE=<licence> emitter/server
node app.js --pub
# after 10 sec
node app.js --sub
@cravler cravler changed the title message TTL not work with inmemory storage provider message TTL not expire with inmemory storage provider Feb 1, 2021
@postacik
Copy link

postacik commented Feb 1, 2021

I made a similar test with inmemory and ssd storage providers and confirm that last: n parameter ignores the ttl for inmemory provider. However it works as expected for ssd provider.

@kelindar
Copy link
Contributor

kelindar commented Feb 1, 2021

Now that badger supports in-memory mode, I'm going to swap the existing in-memory implementation to badger. This will fix this issue.

@kelindar kelindar added the bug label Feb 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants