Update Vercel queue delay cap for longer sleeps#1604
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: da34354 The changes in this PR will be included in the next version bump. This PR includes changesets to release 17 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
No benchmark result files found in benchmark-results |
🧪 E2E Test Results❌ Some tests failed Summary
❌ Failed Tests▲ Vercel Production (8 failed)astro (2 failed):
example (1 failed):
fastify (1 failed):
hono (1 failed):
nitro (1 failed):
nuxt (1 failed):
sveltekit (1 failed):
Details by Category❌ ▲ Vercel Production
✅ 🪟 Windows
❌ Some E2E test jobs failed:
Check the workflow run for details. |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
There was a problem hiding this comment.
Pull request overview
Updates @workflow/world-vercel’s Vercel Queue integration to support longer “sleep” delays by increasing the maximum delayed re-enqueue window and updating dependency + tests accordingly.
Changes:
- Bump
@vercel/queuefrom0.1.4to0.1.6via the pnpm catalog/lockfile. - Increase the default max
delaySecondscap to7d - 1h(601200s) and adjust related inline documentation. - Update the long-sleep clamping test and add a changeset for
@workflow/world-vercel.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pnpm-workspace.yaml | Updates pnpm catalog version for @vercel/queue to 0.1.6. |
| pnpm-lock.yaml | Lockfile updates to reflect @vercel/queue@0.1.6. |
| packages/world-vercel/src/queue.ts | Raises the default delay cap to 7d - 1h and updates chaining documentation. |
| packages/world-vercel/src/queue.test.ts | Adjusts the long-sleep clamping test to the new cap. |
| .changeset/strong-guests-study.md | Publishes a patch changeset for @workflow/world-vercel. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
packages/world-vercel/src/queue.ts
Outdated
| const SECONDS_PER_HOUR = 60 * 60; | ||
| const MAX_QUEUE_DELAY_WINDOW_SECONDS = 7 * 24 * SECONDS_PER_HOUR; | ||
| const MAX_DELAY_SECONDS = Number( | ||
| process.env.VERCEL_QUEUE_MAX_DELAY_SECONDS || 82800 // 23 hours - leave 1h buffer before 24h retention limit | ||
| process.env.VERCEL_QUEUE_MAX_DELAY_SECONDS || | ||
| MAX_QUEUE_DELAY_WINDOW_SECONDS - SECONDS_PER_HOUR | ||
| ); |
There was a problem hiding this comment.
MAX_DELAY_SECONDS is derived from Number(process.env.VERCEL_QUEUE_MAX_DELAY_SECONDS || ...). If the env var is set but non-numeric (or empty), Number(...) becomes NaN, and Math.min(timeoutSeconds, MAX_DELAY_SECONDS) will produce NaN, which then gets forwarded to QueueClient.send({ delaySeconds }). Consider parsing/validating the env var (fallback to the default when invalid) and clamping it to the supported maximum delay (the 7d window minus the 1h buffer) to avoid misconfiguration causing runtime failures.
There was a problem hiding this comment.
Addressed in 6b2568fe. VERCEL_QUEUE_MAX_DELAY_SECONDS now goes through getMaxDelaySeconds(), which falls back for blank/non-numeric/negative values and clamps valid overrides to the supported max before we pass delaySeconds to VQS.
| @@ -1,5 +1,7 @@ | |||
| import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; | |||
|
|
|||
| const MAX_DELAY_SECONDS = 7 * 24 * 60 * 60 - 60 * 60; | |||
There was a problem hiding this comment.
re-use constant from actual file?
There was a problem hiding this comment.
Done in 407954ea — the test now imports MAX_DELAY_SECONDS from queue.ts instead of duplicating the calculation locally.
.changeset/strong-guests-study.md
Outdated
| '@workflow/world-vercel': patch | ||
| --- | ||
|
|
||
| Update the Vercel queue delay cap for longer sleeps. |
There was a problem hiding this comment.
| Update the Vercel queue delay cap for longer sleeps. | |
| Update Vercel queue max delay for longer sleeps without having to re-enqueue as frequently |
There was a problem hiding this comment.
Applied in 407954ea.
| * | ||
| * These constants can be overridden via environment variables for testing. | ||
| */ | ||
| const SECONDS_PER_HOUR = 60 * 60; |
There was a problem hiding this comment.
I think we should actually make this one day. Practically, there'll be no performance or cost difference, BUT if there's infra downtime, and it happens to be the "right" minute, this gives us a bigger margin for queue to re-drive before it gives up? Would have to think through this more deeply but seems like a generally safer approach
| const SECONDS_PER_HOUR = 60 * 60; | |
| const RE_ENQUEUE_MARGIN_SECONDS = 24 * 3600; // 24 hours |
There was a problem hiding this comment.
Makes sense — applied in 407954ea. The re-enqueue margin is now 24 hours, which brings the effective max delayed send to 6 days and gives more room for queue redrive if there is infra turbulence near the delivery boundary.
packages/world-vercel/src/queue.ts
Outdated
| * These constants can be overridden via environment variables for testing. | ||
| */ | ||
| const SECONDS_PER_HOUR = 60 * 60; | ||
| const MAX_QUEUE_DELAY_WINDOW_SECONDS = 7 * 24 * SECONDS_PER_HOUR; |
There was a problem hiding this comment.
| const MAX_QUEUE_DELAY_WINDOW_SECONDS = 7 * 24 * SECONDS_PER_HOUR; | |
| const MAX_QUEUE_DELAY_WINDOW_SECONDS = 7 * 24 * 3600; // 7 days |
There was a problem hiding this comment.
Applied in 407954ea.
packages/world-vercel/src/queue.ts
Outdated
| const MAX_DELAY_SECONDS = Number( | ||
| process.env.VERCEL_QUEUE_MAX_DELAY_SECONDS || 82800 // 23 hours - leave 1h buffer before 24h retention limit | ||
| process.env.VERCEL_QUEUE_MAX_DELAY_SECONDS || | ||
| MAX_QUEUE_DELAY_WINDOW_SECONDS - SECONDS_PER_HOUR |
There was a problem hiding this comment.
| MAX_QUEUE_DELAY_WINDOW_SECONDS - SECONDS_PER_HOUR | |
| MAX_QUEUE_DELAY_WINDOW_SECONDS - RE_ENQUEUE_MARGIN_SECONDS |
There was a problem hiding this comment.
Applied in 407954ea.
Summary
@vercel/queuefrom0.1.4to0.1.6601200seconds)@workflow/world-vercelTesting
pnpm turbo build --filter=@workflow/world-vercel...pnpm --filter @workflow/world-vercel testpnpm exec biome check packages/world-vercel/src/queue.ts packages/world-vercel/src/queue.test.ts