Bulk enqueue (count-based) + dashboard Count field#11
Merged
Conversation
Registers the bulk-enqueue route on the ServeMux and implements the
handler in a dedicated bulk.go. Validates count (1–10000 → 400 otherwise),
builds distinct job.Job values from one payload template, delegates to
broker.EnqueueBulk, and responds 201 with {enqueued, state}. Three new
tests (happy path, bad count, delayed state) followed TDD: RED then GREEN.
TDD: red/green clampCount helper in src/lib/count.ts; enqueueBulk added to src/api.ts; EnqueueForm updated to route count>1 through the bulk endpoint and count==1 through the existing single-job path. web/dist rebuilt.
Owner
Author
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Single-at-a-time enqueues don't move the dashboard charts. This adds bulk enqueue (one request → many jobs) so a click produces a visible traffic spike. The sacred scripts are untouched —
enqueue.lua/claim.luaare byte-identical to base, no new Go dependency, at-least-once preserved (no exactly-once claims).broker.EnqueueBulk(ctx, jobs, opts...) (int, error)— pipelines the existingenqueue.luafor N jobs in one Redis round-trip (no dedup; each job distinct by id). Pre-loads the script (enqueueScript.Load) so pipelinedEVALSHAcan'tNOSCRIPT; increments theenqueuedmetric per job after a successfulExec; empty slice is a no-op.POST /api/queues/{queue}/jobs/bulk(internal/api/bulk.go) —{count, payload, priority?, delay_ms?}→201 {enqueued, state};countcapped 1–10000 (400 otherwise). SinglePOST .../jobsunchanged.client.EnqueueBulk(...) (BulkResult, error)— SDK method; idempotency option ignored (bulk has no dedup).clampCounthelper clamping to the server's 1–10000.Once merged, Railway auto-deploys; the burst control is live at https://relay.prateekm.dev (and the
*.up.railway.appURL).Design & plan
docs/superpowers/specs/2026-06-09-relay-bulk-enqueue-design.mddocs/superpowers/plans/2026-06-09-relay-bulk-enqueue.mdTest plan
go build ./...,go vet ./...,gofmt -l internal/ cmd/clean;go test -race ./...— all packages pass against real Redis (broker 15 / worker 14 / metrics 13 / api 12 / client 11)EnqueueBulk50→ready, delay→delayed, nil→noopEnqueueBulk→ real api/broker →Stats.Ready==25)clampCountunit tests;tsc/vitest/vite build; committedweb/distin syncenqueue.lua/claim.luaunchanged; no new Go dependency