-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Hello everyone.
We have been using your library and noticed that the default outgoing store kept growing if no callback is added to the publish function.
The version that we are using according to yarn.lock:
mqtt@^4.2.6: version "4.2.6" resolved "https://registry.yarnpkg.com/mqtt/-/mqtt-4.2.6.tgz#b655547a9cfb3d86bfb398948b8dbb37e2e3bfd0" integrity sha512-GpxVObyOzL0CGPBqo6B04GinN8JLk12NRYAIkYvARd9ZCoJKevvOyCaWK6bdK/kFSDj3LPDnCsJbezzNlsi87Q== dependencies: commist "^1.0.0" concat-stream "^2.0.0" debug "^4.1.1" help-me "^1.0.1" inherits "^2.0.3" minimist "^1.2.5" mqtt-packet "^6.6.0" pump "^3.0.0" readable-stream "^3.6.0" reinterval "^1.1.0" split2 "^3.1.0" ws "^7.3.1" xtend "^4.0.2"
If I publish like this
mqttClient.publish( topic, JSON.stringify(data), {qos: 1});
This leads to a growing outgoing store if i print mqttClient.
console.log({ store: mqttClient.outgoingStore });
{ store: Store { options: { clean: true }, _inflights: Map(9) { 10212 => [Object], 10213 => [Object], 10214 => [Object], 10215 => [Object], 10216 => [Object], 10217 => [Object], 10218 => [Object], 10219 => [Object], 10220 => [Object] } }
If I publish like this
mqttClient.publish( topic, JSON.stringify({ ...data, traceparent }), {qos: 1}, (e) => { console.log("handled publish")} );
The store is cleared in between publishes.
Forgive me if this is something that has been fixed in a newer release. I figured it would be reasonable to report this finding in case it is a bug. If it is required that one has to add a callback to the publish function, then maybe this should be documented more explicitly.
Thank you for your time :)