Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deno KV: Limitation of backoffSchedule and confusing error message #27536

Open
kitsonk opened this issue Jan 3, 2025 · 0 comments
Open

Deno KV: Limitation of backoffSchedule and confusing error message #27536

kitsonk opened this issue Jan 3, 2025 · 0 comments

Comments

@kitsonk
Copy link
Contributor

kitsonk commented Jan 3, 2025

Version: Deno 2.1.4

Deno has a limit of a backoff schedule of 5 or less intervals. This limit is not documented and the error is uniformative and requires reading the code to actually determine the limit.

For example the following code:

const db = await Deno.open();
await db.enqueue("test", {
  backoffSchedule: [1000, 2000, 4000, 8000, 16000, 32000]
});

Will produce the following error, giving the user no indication of what the problem is:

TypeError: Invalid backoffSchedule
    await db.enqueue("test", {
             ^
    at validateBackoffSchedule (ext:deno_kv/01_db.ts:29:11)
    at Kv.enqueue (ext:deno_kv/01_db.ts:161:7)
    at Router.enqueue (file:///Users/kitsonk/github/herd/mod.ts:285:21)
    at test.ts:1:10

Also, the limitation of 5 intervals makes it difficult to implement a standard 32 or 64 second exponential backoff (as it would require 6 or 7 intervals). It maybe worth considering catering to allow a common pattern of backoff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant