Repository navigation
fix(webapp): avoid float precision loss when converting ms to ns BigInt - #5061
arthi-arumugam-git wants to merge 1 commit into
Conversation
|
|
Caution Review failedThe pull request is closed. Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Hi @arthi-arumugam-git, thanks for your interest in contributing! This project requires that pull request authors are vouched, and you are not in the list of vouched users. This PR will be closed automatically. See https://github.com/triggerdotdev/trigger.dev/blob/main/CONTRIBUTING.md for more details. |
Closes #3292
BigInt(ms * 1_000_000)multiplies in float64 first; epoch-ms*1e6 (~1.7e18) exceeds Number.MAX_SAFE_INTEGER, so the result is rounded. Convert to BigInt first, then multiply (same as existingconvertDateToNanoseconds).Changed:
getNowInNanoseconds,calculateDurationFromStart(common.server.ts), run-engine debug event startTime (runEngineHandlers.server.ts).Verified: over 100k sample epoch-ms values, the old pattern differed from exact
BigInt(ms) * 1_000_000nin 75,000 cases; new pattern is exact. 3-line change, no behavior change other than precision.