Skip to content

Conversation

@noxify
Copy link
Owner

@noxify noxify commented Sep 21, 2025

This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.

Releases

@vorsteh-queue/[email protected]

Minor Changes

  • b18ec50: Added support for batch processing

Patch Changes

@vorsteh-queue/[email protected]

Minor Changes

  • b18ec50: Added support for batch processing

Patch Changes

@vorsteh-queue/[email protected]

Minor Changes

  • b18ec50: Added support for batch processing

Patch Changes

@vorsteh-queue/[email protected]

Minor Changes

  • 66c4848: ### Added

    • Batch processing support: You can now register batch handlers via queue.registerBatch, allowing the queue to process multiple jobs at once according to configurable batch sizes and timing.
    • New batch configuration options: minSize, maxSize, and waitFor allow fine-grained control over when and how batches are processed.
    • Type-safe batch jobs: Batch jobs are strictly separated from scheduled/single jobs and do not support cron, delay, or repeat options.
    • Adapter API extended: All core adapters now support efficient batch operations.
    • Events for batch lifecycle: The queue emits batch:processing, batch:completed, and batch:failed events for batch jobs.

    Handler exclusivity: A queue can handle only batch jobs or single jobs — not both. Attempting to register both handler types in the same queue will throw an error. This ensures clear and predictable processing.

    Example

    import { MemoryQueueAdapter, Queue } from "@vorsteh-queue/core"
    
    type EmailPayload = { to: string; body: string }
    type EmailResult = { ok: boolean }
    
    const adapter = new MemoryQueueAdapter()
    const queue = new Queue<EmailPayload, EmailResult>(adapter, {
      name: "batch-demo",
      batch: { minSize: 5, maxSize: 20, waitFor: 1000 },
    })
    
    queue.registerBatch("send-emails", async (jobs) => {
      // jobs is an array of up to 20 jobs
      await sendBulkEmails(jobs.map((j) => j.payload))
      return jobs.map(() => ({ ok: true }))
    })
    
    // Add jobs as usual
    await queue.addJobs("send-emails", [
      { to: "[email protected]", body: "Hi A" },
      { to: "[email protected]", body: "Hi B" },
      // ...
    ])
    
    queue.start()

Patch Changes

[email protected]

Patch Changes

@vercel
Copy link

vercel bot commented Sep 21, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
vorsteh-queue-docs Ready Ready Preview Comment Oct 27, 2025 8:54pm

@pkg-pr-new
Copy link

pkg-pr-new bot commented Sep 21, 2025

Open in StackBlitz

@vorsteh-queue/adapter-drizzle

npm i https://pkg.pr.new/noxify/vorsteh-queue/@vorsteh-queue/adapter-drizzle@36

@vorsteh-queue/adapter-kysely

npm i https://pkg.pr.new/noxify/vorsteh-queue/@vorsteh-queue/adapter-kysely@36

@vorsteh-queue/adapter-prisma

npm i https://pkg.pr.new/noxify/vorsteh-queue/@vorsteh-queue/adapter-prisma@36

@vorsteh-queue/core

npm i https://pkg.pr.new/noxify/vorsteh-queue/@vorsteh-queue/core@36

create-vorsteh-queue

npm i https://pkg.pr.new/noxify/vorsteh-queue/create-vorsteh-queue@36

commit: d65da0c

@noxify noxify force-pushed the changeset-release/main branch from 6bd2f98 to d65da0c Compare October 27, 2025 20:52
@noxify noxify merged commit e94e5a4 into main Oct 27, 2025
27 checks passed
@noxify noxify deleted the changeset-release/main branch October 27, 2025 21:00
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

Successfully merging this pull request may close these issues.

2 participants