Skip to content

Commit

Permalink
fix for 'no previous subscriptions restored' persistence assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
user1 committed Nov 14, 2017
1 parent a0e5457 commit d4f9d90
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/handlers/subscribe.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ function storeSubscriptions (sub, done) {
return done(null, sub)
}

// if (client.clean) {
// return done(null, sub)
// }
if (client.clean) {
return done(null, sub)
}

perst.addSubscriptions(client, packet.subscriptions, function (err) {
done(err, sub)
Expand Down
2 changes: 1 addition & 1 deletion test/basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -421,12 +421,12 @@ test('do not restore QoS 0 subscriptions when clean', function (t) {

subscribe(t, subscriber, 'hello', 0, function () {
subscriber.inStream.end()
t.equal(subscriber.broker.persistence._subscriptions.size, 0, 'no previous subscriptions restored')

publisher = connect(setup(broker))

subscriber = connect(setup(broker), { clean: true, clientId: 'abcde' }, function (connect) {
t.equal(connect.sessionPresent, false, 'session present is set to false')
t.equal(subscriber.broker.persistence._subscriptions.size, 0, 'no previous subscriptions restored')
publisher.inStream.write({
cmd: 'publish',
topic: 'hello',
Expand Down

0 comments on commit d4f9d90

Please sign in to comment.