Skip to content

Commit d23ef75

Browse files
authored
fix(debugger): allow snapshotsPerSecond to be a float (#7041)
In case `snapshotsPerSecond` is ever a float, make sure that it can safely be converted to a BigInt. This is mostly useful in testing, but it's good to safe-guard against in practise so BigInt doesn't throw an exception.
1 parent bc60861 commit d23ef75

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

packages/dd-trace/src/debugger/devtools_client/breakpoints.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ async function addBreakpoint (probe) {
6464
const snapshotsPerSecond = probe.sampling?.snapshotsPerSecond ?? (probe.captureSnapshot
6565
? MAX_SNAPSHOTS_PER_SECOND_PER_PROBE
6666
: MAX_NON_SNAPSHOTS_PER_SECOND_PER_PROBE)
67-
probe.nsBetweenSampling = BigInt(1 / snapshotsPerSecond * 1e9)
67+
probe.nsBetweenSampling = BigInt(Math.trunc(1 / snapshotsPerSecond * 1e9))
6868
probe.lastCaptureNs = 0n
6969

7070
// Warning: The code below relies on undocumented behavior of the inspector!

0 commit comments

Comments
 (0)