Skip to content

Commit

Permalink
[FIX] [JS] [KV] - fixed an issue where the default maxBucketSize of…
Browse files Browse the repository at this point in the history
… `-1` (a deprecated option) overrode a specified `max_bytes`.

Fixes #706
  • Loading branch information
aricart committed Jun 18, 2024
1 parent 6d63b5c commit c507edd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion jetstream/kv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export function defaultBucketOpts(): Partial<KvOptions> {
replicas: 1,
history: 1,
timeout: 2000,
maxBucketSize: -1,
max_bytes: -1,
maxValueSize: -1,
codec: NoopKvCodecs(),
storage: StorageType.File,
Expand Down
11 changes: 11 additions & 0 deletions jetstream/tests/kv_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2164,3 +2164,14 @@ Deno.test("kv - watcher on server restart", async () => {
await d;
await cleanup(ns, nc);
});

Deno.test("kv - maxBucketSize doesn't override max_bytes", async () => {
let { ns, nc } = await setup(
jetstreamServerConf({}),
);
const js = nc.jetstream();
const kv = await js.views.kv("A", { max_bytes: 100 });
const info = await kv.status();
assertEquals(info.max_bytes, 100);
await cleanup(ns, nc);
});

0 comments on commit c507edd

Please sign in to comment.