From d4f9d9026ce9a5f29b2923850f68e6cdb81d0340 Mon Sep 17 00:00:00 2001 From: user1 Date: Tue, 14 Nov 2017 11:17:18 -0500 Subject: [PATCH] fix for 'no previous subscriptions restored' persistence assertion --- lib/handlers/subscribe.js | 6 +++--- test/basic.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/handlers/subscribe.js b/lib/handlers/subscribe.js index 8753074c..880c5b7f 100644 --- a/lib/handlers/subscribe.js +++ b/lib/handlers/subscribe.js @@ -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) diff --git a/test/basic.js b/test/basic.js index e5717725..3f4affc7 100644 --- a/test/basic.js +++ b/test/basic.js @@ -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',