aedes: [bug]Unsubscribe crush while import mq & persistence at the same time.

Client unsubscribe will crush while using mq & persistence at the same time. Complete sample is below:

server

const redisStore = require("mqemitter-redis")
const aedesPersistenceRedis = require("aedes-persistence-redis")
let mqStore = redisStore({
    host: '127.0.0.1'
});
let persistStore = aedesPersistenceRedis({
    host: '127.0.0.1'
});

const aedes = require('aedes')({
    mq: mqStore,
    persistence: persistStore,
});
const server = require('net').createServer(aedes.handle)
const port = 1883

server.listen(port, function () {
    console.log('server started and listening on port ', port)
})

client

const mqtt = require('mqtt')
let client  = mqtt.connect({
    servers: [{
        host: 'localhost',
        port: 1883,
        protocol: 'tcp'
    }]
});

client.on('connect', function () {
    client.subscribe('presence', function (err) {
        if (!err) {
            client.unsubscribe('presence', (err)=>{
                if(err)
                    console.log(err);
                else
                    console.log('suc');
            })
        }
    })
});

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 16 (9 by maintainers)

Most upvoted comments

@robertsLando where do you see I submit a PR, you will see there may be more upcoming changes. I try to split a PR into as small as possible.