Skip to content

Commit e6fc2bc

Browse files
committed
fix: ceil stream remaining timeout to satisfy integer limit validation
hostDateNow() on an installed test clock can return fractional milliseconds (performance.now() is the clock's time origin). The difference deadline - hostDateNow() inherits that fraction, which fails the Number.isSafeInteger check in serverResultLimits and throws a RangeError instead of applying the leftover deadline. Math.ceil ensures the remaining timeout is always an integer while rounding toward the deadline rather than away from it.
1 parent 44e1c90 commit e6fc2bc

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎packages/octane/src/server-rpc-response.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export async function readServerResponse(
6868
new Error('The server does not support the requested result protocol'),
6969
);
7070
}
71-
const remaining = deadline! - hostDateNow();
71+
const remaining = Math.ceil(deadline! - hostDateNow());
7272
if (remaining <= 0) {
7373
void response.body?.cancel().catch(() => {});
7474
throw new ServerCallUncertainError(

0 commit comments

Comments
 (0)