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

Improve performance when logging is disabled #23893

Merged
merged 29 commits into from
Sep 12, 2024
Merged
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
0a06d37
Improve log performance
tomer-w Sep 7, 2024
6765245
Merge branch 'master' of https://github.com/tomer-w/zigbee2mqtt
tomer-w Sep 7, 2024
83ba5a2
Bug fix
tomer-w Sep 7, 2024
a00f522
Revert sample configuration
tomer-w Sep 7, 2024
cac4b34
Align package versions
tomer-w Sep 7, 2024
16f550c
Merge branch 'dev' into master
tomer-w Sep 7, 2024
1632163
Revert dependecies version to allow testing
tomer-w Sep 8, 2024
80f0637
Merge branch 'master' of https://github.com/tomer-w/zigbee2mqtt
tomer-w Sep 8, 2024
ff732a1
Update package-lock.json
tomer-w Sep 8, 2024
db8fc5f
Fix prettier issue
tomer-w Sep 8, 2024
97e56ba
Coverage to 100%
tomer-w Sep 8, 2024
6b4be32
Fix CR comments
tomer-w Sep 9, 2024
7842842
remove uneeded changes
tomer-w Sep 9, 2024
5015038
Make the same perf optimization to the MQTT messages
tomer-w Sep 9, 2024
c0128d9
Fix MQTT tests
tomer-w Sep 9, 2024
5b6f176
prettier fix
tomer-w Sep 9, 2024
de5b9d6
Allow easy mocking of stub logger callTransports function to receive …
tomer-w Sep 11, 2024
ed7c82e
cleanup leftover
tomer-w Sep 11, 2024
75e81f8
Fix prettier issues
tomer-w Sep 11, 2024
df6e9f3
Merge branch 'dev' into master
tomer-w Sep 11, 2024
bb2c4be
Finalize logger mock structure and add few lambda log calls
tomer-w Sep 12, 2024
2081f9e
Merge branch 'master' of https://github.com/tomer-w/zigbee2mqtt
tomer-w Sep 12, 2024
b409d53
fix prettier issue
tomer-w Sep 12, 2024
1c88f02
Run prettier
tomer-w Sep 12, 2024
da7f8fb
Merge branch 'master' of https://github.com/tomer-w/zigbee2mqtt
tomer-w Sep 12, 2024
f7b88ff
Revert "fix prettier issue"
tomer-w Sep 12, 2024
f14d9f1
Update zigbee.ts
tomer-w Sep 12, 2024
113b299
Fix test issues
tomer-w Sep 12, 2024
48a2157
Revert await removal
tomer-w Sep 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Make the same perf optimization to the MQTT messages
tomer-w committed Sep 9, 2024
commit 5015038792f9b3f0ce0ebad79526cea9096c3982
4 changes: 2 additions & 2 deletions lib/mqtt.ts
Original file line number Diff line number Diff line change
@@ -145,7 +145,7 @@ export default class MQTT {
@bind public onMessage(topic: string, message: Buffer): void {
// Since we subscribe to zigbee2mqtt/# we also receive the message we send ourselves, skip these.
if (!this.publishedTopics.has(topic)) {
logger.debug(`Received MQTT message on '${topic}' with data '${message.toString()}'`, NS);
logger.debug(() => `Received MQTT message on '${topic}' with data '${message.toString()}'`, NS);
this.eventBus.emitMQTTMessage({topic, message: message.toString()});
}

@@ -196,7 +196,7 @@ export default class MQTT {
}

if (!skipLog) {
logger.info(`MQTT publish: topic '${topic}', payload '${payload}'`, NS);
logger.info(() => `MQTT publish: topic '${topic}', payload '${payload}'`, NS);
}

const actualOptions: mqtt.IClientPublishOptions = {...defaultOptions, ...options};