Skip to content

Commit 2f6dad5

Browse files
thomasballingerConvex, Inc.
authored andcommitted
Enable transition chunks (#42095)
GitOrigin-RevId: 7776fea425bfb79ae3a63678963108cfce069631
1 parent 1804b18 commit 2f6dad5

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

crates/common/src/version.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ pub static MIN_NPM_VERSION_FOR_TRANSITION_CHUNKS: LazyLock<Version> = LazyLock::
5151
env_config(
5252
// Until clients can handle these better use a large number we'll never hit.
5353
"MIN_NPM_VERSION_FOR_TRANSITION_CHUNKS",
54-
Version::parse("1.999.0").expect("Invalid version"),
54+
Version::parse("1.28.0").expect("Invalid version"),
5555
)
5656
});
5757

crates/local_backend/src/subs/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,12 +232,12 @@ async fn run_sync_socket(
232232
Some(m) => m,
233233
None => break 'top,
234234
};
235-
let delay = st.runtime.monotonic_now() - send_time;
236-
log_websocket_message_out(&message, delay);
237235
message.inject_server_ts(st.runtime.generate_timestamp()?);
238236
let messages =
239237
maybe_split_transition(message, config.supports_transition_chunks)?;
240238
for msg in messages {
239+
let delay = st.runtime.monotonic_now() - send_time;
240+
log_websocket_message_out(&msg, delay);
241241
let serialized = serde_json::to_string(&JsonValue::from(msg))?;
242242
if tx.send(Message::Text(serialized.into())).await.is_err() {
243243
break 'top;

npm-packages/js-integration-tests/convex/largeResponse.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import { query } from "./_generated/server";
33

44
// Will be a bit over for serialization and the array.
55
export const largeArray = query({
6-
args: { bytes: v.number() },
6+
args: { count: v.number(), character: v.string() },
77
handler: async (_ctx, args) => {
8-
let left = args.bytes;
8+
let left = args.count;
99
const items = [];
1010
const largeString = "x".repeat(1_000_000);
1111
while (left > 0) {

npm-packages/js-integration-tests/largeResponse.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,17 @@ describe("Large query responses", () => {
1616

1717
test("query with small response works", async () => {
1818
const result = await client.query(api.largeResponse.largeArray, {
19-
bytes: 1000,
19+
count: 1000,
20+
character: "€", // 3 bytes in utf-8, 2 bytes in utf-16, one character in JS
2021
});
2122
expect(result).toBeDefined();
2223
expect(Array.isArray(result)).toBe(true);
2324
});
2425

2526
test("query with >5MB response", async () => {
2627
const result = await client.query(api.largeResponse.largeArray, {
27-
bytes: 6_000_000,
28+
count: 6_000_000,
29+
character: "€", // 3 bytes in utf-8, 2 bytes in utf-16, one character in JS
2830
});
2931
expect(result).toBeDefined();
3032
// The result should be close to 6MB

0 commit comments

Comments
 (0)