npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ecodrix/erix-worker

v1.1.0

Published

BullMQ-style worker for erix-store. Auto-polling job processor with heartbeat, retry, and graceful shutdown.

Readme

@ecodrix/erix-worker

BullMQ-style worker for erix-store. Auto-polling job processor with heartbeat, retry, and graceful shutdown.

Installation

pnpm add @ecodrix/erix-client @ecodrix/erix-worker

Usage

Basic Example

import { ErixClient } from '@ecodrix/erix-client'
import { ErixWorker } from '@ecodrix/erix-worker'

// 1. Create client (like Redis)
const client = new ErixClient({
  baseUrl: 'https://erix-store.onrender.com',
  apiKey: process.env.ERIX_API_KEY!,
  tenantId: 'org_abc123',
})

// 2. Create worker (like BullMQ)
const worker = new ErixWorker(client, 'scrape-queue', async (job) => {
  console.log('Processing:', job.data)
  await doWork(job.data)
})

// 3. Start worker
worker.run() // Keeps polling for jobs

Auto-Start Worker

const worker = new ErixWorker(client, 'scrape-queue', handler, {
  autoStart: true, // Starts immediately
})

With Options

const worker = new ErixWorker(client, 'scrape-queue', handler, {
  pollIntervalMs: 3000,        // Poll every 3 seconds
  maxConcurrentJobs: 5,        // Process 5 jobs at once
  heartbeatIntervalMs: 15000,  // Heartbeat every 15 seconds
  autoStart: true,             // Start immediately
})

Custom Logger

import pino from 'pino'

const logger = pino()

const worker = new ErixWorker(client, 'scrape-queue', handler, {
  logger: {
    info: (msg, meta) => logger.info(meta, msg),
    warn: (msg, meta) => logger.warn(meta, msg),
    error: (msg, meta) => logger.error(meta, msg),
  },
})

Graceful Shutdown

// Worker automatically handles SIGTERM and SIGINT
// Or manually stop:
await worker.stop()

Worker Statistics

const stats = worker.getStats()
console.log(stats)
// {
//   totalJobsProcessed: 42,
//   successfulJobs: 40,
//   failedJobs: 2,
//   currentConcurrency: 3,
//   isRunning: true,
//   activeJobs: 3
// }

How It Works

  1. Polling: Worker polls client.queueV2.claim() every pollIntervalMs
  2. Concurrency: Processes up to maxConcurrentJobs simultaneously
  3. Heartbeat: Sends heartbeat every heartbeatIntervalMs to keep jobs alive
  4. Retry: Failed jobs are automatically retried by erix-store (up to maxAttempts)
  5. Graceful Shutdown: Waits for active jobs to complete (max 30s) before stopping

Comparison with BullMQ

| Feature | BullMQ | @ecodrix/erix-worker | |---------|--------|---------------------| | Queue Backend | Redis | erix-store | | Worker API | new Worker(name, handler) | new ErixWorker(client, name, handler) | | Start Worker | worker.run() | worker.run() | | Stop Worker | worker.close() | worker.stop() | | Concurrency | ✅ | ✅ | | Heartbeat | ✅ | ✅ | | Retry | ✅ | ✅ (handled by erix-store) | | Priority | ✅ | ✅ | | Delayed Jobs | ✅ | ✅ | | Events | ✅ (Redis pub/sub) | ✅ (SSE via queueV2.subscribe) |

Advanced: Event-Driven Worker

Instead of polling, you can use Server-Sent Events (SSE) for real-time job notifications:

// Subscribe to queue events
const subscription = client.queueV2.subscribe('scrape-queue', {
  onAdded: async () => {
    // New job added, claim it
    const job = await client.queueV2.claim('scrape-queue')
    if (job) {
      await handler(job)
      await client.queueV2.complete(job.id)
    }
  },
  onError: (err) => console.error(err),
})

// Later: unsubscribe
subscription.close()

License

MIT