Skip to content
This repository has been archived by the owner on May 16, 2024. It is now read-only.

Commit

Permalink
fix: emit copy of metrics (#1)
Browse files Browse the repository at this point in the history
To prevent observers changing internal state, emit a copy of the metrics.
  • Loading branch information
achingbrain committed Sep 20, 2023
1 parent 8175453 commit ede5c64
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ class SimpleMetrics implements Metrics, Startable {
}
}

this.onMetrics(output)
this.onMetrics(JSON.parse(JSON.stringify(output)))
})
.catch(err => {
log.error('could not invoke onMetrics callback', err)
Expand Down

0 comments on commit ede5c64

Please sign in to comment.