Skip to content

Commit

Permalink
fix: allow for undefined uniqueListerners
Browse files Browse the repository at this point in the history
  • Loading branch information
WillieRuemmele committed Jul 3, 2024
1 parent f08cce8 commit 5c6779c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/lifecycleEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,5 +238,6 @@ export class Lifecycle {
}

const cloneListeners: (listeners: ListenerMap) => ListenerMap = (listeners) => new Map(Array.from(listeners.entries()));
export const cloneUniqueListeners = (uniqueListeners: UniqueListenerMap): UniqueListenerMap =>
new Map(Array.from(uniqueListeners.entries()).map(([key, value]) => [key, cloneListeners(value)]));
export const cloneUniqueListeners = (uniqueListeners: UniqueListenerMap | undefined): UniqueListenerMap =>
// in case we're crossing major sfdx-core versions where uniqueListeners might be undefined
new Map(Array.from(uniqueListeners?.entries() ?? []).map(([key, value]) => [key, cloneListeners(value)]));

3 comments on commit 5c6779c

@svc-cli-bot
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logger Benchmarks - ubuntu-latest

Benchmark suite Current: 5c6779c Previous: 41938ab Ratio
Child logger creation 478191 ops/sec (±1.84%) 461080 ops/sec (±1.21%) 0.96
Logging a string on root logger 870280 ops/sec (±12.27%) 818071 ops/sec (±7.52%) 0.94
Logging an object on root logger 628199 ops/sec (±7.83%) 607819 ops/sec (±7.84%) 0.97
Logging an object with a message on root logger 1607 ops/sec (±276.35%) 5340 ops/sec (±215.10%) 3.32
Logging an object with a redacted prop on root logger 457971 ops/sec (±10.17%) 448919 ops/sec (±5.65%) 0.98
Logging a nested 3-level object on root logger 392874 ops/sec (±6.21%) 366550 ops/sec (±7.53%) 0.93

This comment was automatically generated by workflow using github-action-benchmark.

@svc-cli-bot
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Logger Benchmarks - ubuntu-latest'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: 5c6779c Previous: 41938ab Ratio
Logging an object with a message on root logger 1607 ops/sec (±276.35%) 5340 ops/sec (±215.10%) 3.32

This comment was automatically generated by workflow using github-action-benchmark.

@svc-cli-bot
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logger Benchmarks - windows-latest

Benchmark suite Current: 5c6779c Previous: 41938ab Ratio
Child logger creation 323567 ops/sec (±0.97%) 326785 ops/sec (±0.87%) 1.01
Logging a string on root logger 687021 ops/sec (±5.18%) 747333 ops/sec (±4.67%) 1.09
Logging an object on root logger 586627 ops/sec (±6.82%) 572289 ops/sec (±5.50%) 0.98
Logging an object with a message on root logger 11921 ops/sec (±189.24%) 9031 ops/sec (±200.49%) 0.76
Logging an object with a redacted prop on root logger 431254 ops/sec (±7.31%) 445033 ops/sec (±5.63%) 1.03
Logging a nested 3-level object on root logger 298934 ops/sec (±5.95%) 326680 ops/sec (±6.43%) 1.09

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.