Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow user to disable pre-generated write cache #1151

Merged

Conversation

mwohlert
Copy link
Contributor

This change allows the user of the library to disable the pre-generated write cache generated by mqtt-packet and instead rely on in-flight generated buffers. This helps to preserve memory in low-memory environments, but possibly degrading mqtt-stream write performance.

@ynagasaki
Copy link
Contributor

This is an old PR, but I wanted to bump it. I also encountered the same use case and this PR would fix our issue nicely.

In my case, our project swaps all MQTT imports with the dist/mqtt.min.js that is included in this project's module. Because of this, we are unable to access the writeToStream.cacheNumbers property in the embedded mqtt-packet module that is bundled in mqtt.min.js.

At the moment, we're unable to remove the mqtt.dist.js replacement, so it would really help if this setting was exposed by this package also. Thanks.

@robertsLando
Copy link
Member

@mwohlert Can you add a unit test for this?

@robertsLando robertsLando changed the title Allow user to disable pre-generated write cache feat: allow user to disable pre-generated write cache Jun 27, 2023
@ynagasaki
Copy link
Contributor

Hi @robertsLando, I added a unit test on behalf of @mwohlert

@robertsLando robertsLando merged commit 0d11888 into mqttjs:master Jun 29, 2023
2 checks passed
robertsLando added a commit that referenced this pull request Jul 3, 2023
…1622)

@vishnureddy17 Fix typo in README 00bf657
@bverhoeven Fix memory leak in subscription topic mapping (#1535) 8c77eec
@mwohlert @robertsLando @ynagasaki feat: allow user to disable pre-generated write cache (#1151) 0d11888

Co-authored-by: Daniel Lando <daniel.sorridi@gmail.com>
Co-authored-by: Yoshi Nagasaki <yn253@cornell.edu>
Co-authored-by: Dmitry Kurmanov <kurmanov.work@gmail.com>
Co-authored-by: Vishnu Reddy <vishnureddy@microsoft.com>
Co-authored-by: Bas Verhoeven <soczol@gmail.com>
Co-authored-by: Michel Wohlert <michel.wohlert@gmail.com>
@robertsLando
Copy link
Member

@ynagasaki This will be available on next beta. Doing it right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants