-
-
Notifications
You must be signed in to change notification settings - Fork 239
chore: reduce production dependencies #1045
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
Open
seriousme
wants to merge
21
commits into
moscajs:main
Choose a base branch
from
seriousme:reduce-production-dependencies
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
c0f3047
chore: reduce production dependencies
seriousme e880e5f
Merge branch 'main' into reduce-production-dependencies
robertsLando 9e5d2c7
apply copilot review comments
seriousme f4aebec
remove ObjectPool
seriousme 3d7fd28
applied comments in timer and refactored clearWills
seriousme 1b3bb3d
test many wills
seriousme cb8ca24
increase coverage of subscribe.js
seriousme ac207b0
move runFall() to utils
seriousme a86f22d
applied mcollina's comments on close, sub and unsub
seriousme 6fed21d
remove retimer
seriousme c2cc706
add batch() tests to test/utils.js
seriousme e8d6a4b
Remove brackets around chunks
seriousme bfeb6ca
move runSeries to utils.js
seriousme 3a35a63
Merge branch 'main' into reduce-production-dependencies
seriousme 31a9bc1
Merge branch 'main' into reduce-production-dependencies
robertsLando 6e4e287
Merge branch 'main' into reduce-production-dependencies
robertsLando b486014
fix open items
seriousme e366386
fix susbcribe and unsubscribe items
seriousme b36916c
modernize socket destruction
seriousme 7313585
fix missing coverage testing
seriousme f0ed980
centralize once() check
seriousme File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,13 @@ | ||
| import mqtt from 'mqtt-packet' | ||
| import EventEmitter from 'node:events' | ||
| import util from 'util' | ||
| import eos from 'end-of-stream' | ||
| import Packet from 'aedes-packet' | ||
| import write from './write.js' | ||
| import QoSPacket from './qos-packet.js' | ||
| import handleSubscribe from './handlers/subscribe.js' | ||
| import handleUnsubscribe from './handlers/unsubscribe.js' | ||
| import handle from './handlers/index.js' | ||
| import { pipeline } from 'stream' | ||
| import { pipeline, finished } from 'stream' | ||
|
seriousme marked this conversation as resolved.
|
||
| import { through } from './utils.js' | ||
|
|
||
| class Client { | ||
|
|
@@ -88,7 +87,7 @@ class Client { | |
| this._parser.on('error', this.emit.bind(this, 'error')) | ||
|
|
||
| conn.on('end', this.close.bind(this)) | ||
| this._eos = eos(this.conn, this.close.bind(this)) | ||
| this._eos = finished(this.conn, this.close.bind(this)) | ||
|
|
||
| const getToForwardPacket = (_packet) => { | ||
| // Mqttv5 3.8.3.1: https://docs.oasis-open.org/mqtt/mqtt/v5.0/mqtt-v5.0.html#_Toc3901169 | ||
|
|
@@ -171,9 +170,9 @@ class Client { | |
| this.conn.removeAllListeners('error') | ||
| this.conn.on('error', noop) | ||
| // hack to clean up the write callbacks in case of error | ||
| const state = this.conn._writableState | ||
| const list = typeof state.getBuffer === 'function' ? state.getBuffer() : state.buffer | ||
| list.forEach(drainRequest) | ||
|
Comment on lines
-174
to
-176
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know this was an old hacky hack to fix an annoying but, wondering if it's still legit or not, no clue if we ever have a test that covered this |
||
| if (!this.conn.destroyed) { | ||
| this.conn.destroy(err) | ||
| } | ||
| this.broker.emit(this.id ? 'clientError' : 'connectionError', this, err) | ||
| this.close() | ||
| } | ||
|
|
@@ -320,7 +319,7 @@ class Client { | |
| this._parser._queue = null | ||
|
|
||
| if (this._keepaliveTimer) { | ||
| this._keepaliveTimer.clear() | ||
| clearTimeout(this._keepaliveTimer) | ||
| this._keepaliveInterval = -1 | ||
| this._keepaliveTimer = null | ||
| } | ||
|
|
@@ -461,10 +460,6 @@ function writeQoS (err, client, packet) { | |
| } | ||
| } | ||
|
|
||
| function drainRequest (req) { | ||
| req.callback() | ||
| } | ||
|
|
||
| util.inherits(Client, EventEmitter) | ||
|
|
||
| function enqueue (packet) { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.