Skip to content

Commit

Permalink
chore(deps): bumped deps and fixed standard issues (#46)
Browse files Browse the repository at this point in the history
* chore(deps): bumped deps and fixed standard issues

aedes-persistence   ^8.1.1  →   ^8.1.2
 fastparallel        ^2.3.0  →   ^2.4.0
 multistream         ^4.0.0  →   ^4.0.1
 qlobber             ^5.0.0  →   ^5.0.3
 mqemitter           ^4.2.0  →   ^4.4.0
 nyc                ^15.0.1  →  ^15.1.0
 release-it         ^14.0.3  →  ^14.2.2
 standard           ^15.0.0  →  ^16.0.3
 through2            ^4.0.1  →   ^4.0.2

* fix: disable standard no-var rule in index.js
  • Loading branch information
robertsLando authored Feb 3, 2021
1 parent e1c7093 commit 35e0c51
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 30 deletions.
2 changes: 1 addition & 1 deletion abstract.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict'

var parent = require('aedes-persistence/abstract')
const parent = require('aedes-persistence/abstract')

module.exports = parent
17 changes: 9 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-var */
'use strict'

const QlobberSub = require('qlobber/aedes/qlobber-sub')
Expand Down Expand Up @@ -36,10 +37,10 @@ function CachedPersistence (opts) {
})

this._onMessage = function onSubMessage (packet, cb) {
var decoded = JSON.parse(packet.payload)
var clientId = decoded.clientId
const decoded = JSON.parse(packet.payload)
const clientId = decoded.clientId
for (var i = 0; i < decoded.subs.length; i++) {
var sub = decoded.subs[i]
const sub = decoded.subs[i]
sub.clientId = clientId
if (packet.topic === newSubTopic) {
if (sub.qos > 0) {
Expand All @@ -51,12 +52,12 @@ function CachedPersistence (opts) {
that._trie.remove(sub.topic, sub)
}
}
var action = packet.topic === newSubTopic ? 'sub_' : 'unsub_'
const action = packet.topic === newSubTopic ? 'sub_' : 'unsub_'
var key = clientId + '-' + action
if (decoded.subs.length > 0) {
key = clientId + '-' + action + decoded.subs[0].topic
}
var waiting = that._waiting[key]
const waiting = that._waiting[key]
that._waiting[key] = undefined
if (waiting) {
process.nextTick(waiting)
Expand Down Expand Up @@ -108,8 +109,8 @@ CachedPersistence.prototype._addedSubscriptions = function (client, subs, cb) {
}

function brokerPublish (subs, cb) {
var encoded = JSON.stringify({ clientId: this.client.id, subs: subs })
var packet = new Packet({
const encoded = JSON.stringify({ clientId: this.client.id, subs: subs })
const packet = new Packet({
topic: this.topic,
payload: encoded
})
Expand Down Expand Up @@ -184,7 +185,7 @@ function outgoingEnqueue (sub, cb) {

CachedPersistence.prototype.createRetainedStreamCombi = function (patterns) {
const that = this
var streams = patterns.map(function (p) {
const streams = patterns.map(function (p) {
return that.createRetainedStream(p)
})
return MultiStream.obj(streams)
Expand Down
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,19 @@
"concat-stream": "^2.0.0",
"faucet": "0.0.1",
"license-checker": "^25.0.1",
"mqemitter": "^4.2.0",
"nyc": "^15.0.1",
"mqemitter": "^4.4.0",
"nyc": "^15.1.0",
"pump": "^3.0.0",
"release-it": "^14.0.3",
"release-it": "^14.2.2",
"snazzy": "^9.0.0",
"standard": "^15.0.0",
"standard": "^16.0.3",
"tape": "^4.13.2",
"through2": "^4.0.1"
"through2": "^4.0.2"
},
"dependencies": {
"aedes-persistence": "^8.1.1",
"fastparallel": "^2.3.0",
"multistream": "^4.0.0",
"qlobber": "^5.0.0"
"aedes-persistence": "^8.1.2",
"fastparallel": "^2.4.0",
"multistream": "^4.0.1",
"qlobber": "^5.0.3"
}
}
24 changes: 12 additions & 12 deletions test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
'use strict'

var test = require('tape').test
var CachedPersistence = require('./')
var util = require('util')
var Memory = require('aedes-persistence')
var abs = require('./abstract')
const test = require('tape').test
const CachedPersistence = require('./')
const util = require('util')
const Memory = require('aedes-persistence')
const abs = require('./abstract')

function MyPersistence () {
if (!(this instanceof MyPersistence)) {
Expand Down Expand Up @@ -36,15 +36,15 @@ util.inherits(MyPersistence, CachedPersistence)
})

MyPersistence.prototype.addSubscriptions = function (client, subs, cb) {
var stored = this._subscriptions.get(client.id)
let stored = this._subscriptions.get(client.id)

if (!stored) {
stored = new Map()
this._subscriptions.set(client.id, stored)
this._clientsCount++
}

var subsObjs = subs.map(function mapSub (sub) {
const subsObjs = subs.map(function mapSub (sub) {
stored.set(sub.topic, sub.qos)
return {
clientId: client.id,
Expand All @@ -57,13 +57,13 @@ MyPersistence.prototype.addSubscriptions = function (client, subs, cb) {
}

MyPersistence.prototype.removeSubscriptions = function (client, subs, cb) {
var stored = this._subscriptions.get(client.id)
var removed = []
const stored = this._subscriptions.get(client.id)
const removed = []

if (stored) {
for (var i = 0; i < subs.length; i += 1) {
var topic = subs[i]
var qos = stored.get(topic)
for (let i = 0; i < subs.length; i += 1) {
const topic = subs[i]
const qos = stored.get(topic)
if (qos !== undefined) {
if (qos > 0) {
removed.push({
Expand Down

0 comments on commit 35e0c51

Please sign in to comment.