惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Apple Machine Learning Research
Apple Machine Learning Research
博客园 - 三生石上(FineUI控件)
雷峰网
雷峰网
WordPress大学
WordPress大学
S
SegmentFault 最新的问题
博客园 - 叶小钗
The Cloudflare Blog
T
Tailwind CSS Blog
Hugging Face - Blog
Hugging Face - Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
月光博客
月光博客
小众软件
小众软件
罗磊的独立博客
酷 壳 – CoolShell
酷 壳 – CoolShell
大猫的无限游戏
大猫的无限游戏
阮一峰的网络日志
阮一峰的网络日志
V
V2EX
美团技术团队
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 聂微东
量子位
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
宝玉的分享
宝玉的分享

Hacker News: Show HN

PurrrrrFocus: Pomodoro Timer App - App Store Workflow Engine — Multi-Step Orchestration for Bun RapidPhoto: Pro Photo Editor App - App Store GitHub - DheerG/swarms: Achieve extraordinary results with claude code across a variety of tasks SPICE simulation → oscilloscope → verification with Claude Code — Lucas Gerads Show HN: VCoding – A 5 MB native Windows IDE with no dynamic dependencies Show HN: LLMs don't hallucinate because they're bad at math, it's the format GitHub - Agent-FM/agentfm-core: AgentFM is a peer-to-peer network that turns everyday computers into a decentralized AI supercomputer. AgentFM lets you run massive AI workloads directly across a global mesh of idle CPUs and GPUs. Show HN: Tracking Top US Science Olympiad Alumni over Last 25 Years GitHub - Potarix/agent-hub: One place to talk to all your agents Show HN: Runtime security for AI agents(injection,tool abuse, data exfiltration) GitHub - dubeyKartikay/lazyspotify: Terminal Spotify client for macOS and Linux GitHub - the-banana-tool/king-louie: Easy to use GUI Personal AI Assistant. Win/Linux/Mac. Show HN I made my vacation rental bookable by AI agents–no Airbnb, 0% commission GitHub - basteez/jsf-autoreload: maven plugin to enable hot reload on jsf projects uvm32/hosts/host-gdbstub at main · ringtailsoftware/uvm32 GitHub - labsai/EDDI: Config-driven engine that turns JSON into production-grade AI agents. Multi-agent orchestration, 12+ LLM providers, MCP/A2A protocols, RAG, persistent memory, and enterprise compliance (EU AI Act, GDPR, HIPAA). Built on Quarkus. GitHub - glitchnsec/fortyone-oss: AI Executive Assistant Platform Quickstart | Alien GitHub - muxshed/shed: One stream in, or many. Every destination, simultaneously. No cloud middleman, no per-channel fees, no limits. GitHub - ocrbase-hq/ocrbase: 📄 PDF/IMG ->.MD/JSON Document OCR API for PaddleOCR and GLMOCR. Self-hostable. GitHub - impactjo/home-memory: MCP server that lets your AI assistant remember everything about your home. GitHub - Sets88/dbcls: DbCls is a powerful terminal database client that supports various databases GitHub - neptun2000/heor-agent-mcp GitHub - SeanFDZ/macmind: Single-layer transformer in HyperTalk for the classic Macintosh RollQuation: Math Puzzles - Apps on Google Play GitHub - dropbox/witchcraft Show HN: Agent-cache – Multi-tier LLM/tool/session caching for Valkey and Redis GitHub - opentalon/opentalon: OpenTalon is an open-source platform built from the ground up in Go as a robust alternative to OpenClaw LinkedIn™ 职位抓取工具 - Chrome 应用商店
GitHub - emirce/supaqueue: A fast in-memory job queue for...
emirce · 2026-06-21 · via Hacker News: Show HN

supaqueue is a lightweight, type-safe in-memory background job queue for Node.js with zero dependencies. Use it when you need background jobs, retries, concurrency, delayed work, or scheduled tasks without setting up Redis, Postgres, or external queue infrastructure.

It is best suited for small apps, side projects, local tools, CLIs, and services where losing queued jobs on process restart is acceptable. If you need durable jobs across deploys or multiple workers across machines, use a persistent queue such as BullMQ, pg-boss, or a hosted worker system.

Features

  • In-memory jobs with zero external services.
  • Concurrency control, delayed jobs, and retries.
  • Fixed-delay and exponential-backoff retry strategies.
  • Pause/resume controls and job lifecycle events.
  • Repeating jobs with intervals or cron expressions.
  • TypeScript types for job data and results.

Install

Quick Start

import { createQueue } from "supaqueue";

const emailQueue = createQueue<{ to: string; subject: string }>(
  async (job) => {
    await sendEmail(job.data.to, job.data.subject);
    return { sent: true };
  },
  {
    concurrency: 2,
  },
);

emailQueue.addJob("welcome-email", {
  to: "dev@example.com",
  subject: "Welcome",
});

Jobs start processing as soon as they are added unless the queue is paused or the job has a delay.

Queue Options

const queue = createQueue(processor, {
  concurrency: 4,
  paused: false,
  lifo: false,
  defaultJobOptions: {
    removeOnComplete: 100,
    removeOnFail: { age: 24 * 60 * 60, count: 1000 },
  },
});
  • concurrency: number of jobs to process at the same time. Defaults to 1.
  • paused: create the queue in a paused state. Defaults to false.
  • lifo: process newest waiting jobs first. Defaults to FIFO.
  • defaultJobOptions: default options applied to every job. Per-job options override these defaults.

Adding Jobs

queue.addJob("resize-image", {
  imageId: "img_123",
});

Delayed Jobs

queue.addJob(
  "send-reminder",
  { userId: "user_123" },
  { delay: 60_000 },
);

Retries

import { JobRetryStrategy } from "supaqueue";

queue.addJob(
  "sync-account",
  { accountId: "acct_123" },
  {
    attempts: 3,
    delay: 1_000,
    retryStrategy: JobRetryStrategy.ExponentialBackoff,
  },
);

attempts is the number of retries after the first failed run. With fixed delay, each retry waits for delay. With exponential backoff, the delay increases after each failed attempt.

Auto-removing Finished Jobs

By default, completed and failed jobs are kept in memory so they remain visible through getJob() and getJobs(). Use removeOnComplete and removeOnFail to remove or limit finished jobs.

queue.addJob(
  "send-email",
  { userId: "user_123" },
  {
    removeOnComplete: true,
    removeOnFail: 1000,
  },
);

removeOnComplete and removeOnFail support:

  • true: remove the job as soon as it reaches that terminal state.
  • false: keep jobs in memory. This is the default.
  • number: keep only the newest N jobs for that terminal state.
  • { age }: keep jobs newer than age seconds.
  • { count }: keep only the newest count jobs.
  • { age, count }: apply both limits.

Events

queue.on("waiting", (job) => {
  console.log("Waiting:", job.name);
});

queue.on("active", (job) => {
  console.log("Started:", job.id);
});

queue.on("completed", (job, result) => {
  console.log("Completed:", job.id, result);
});

queue.on("failed", (job, error) => {
  console.error("Failed:", job.id, error);
});

Available events:

  • waiting
  • active
  • completed
  • failed
  • paused
  • resumed

Pause and Resume

queue.pause();

queue.addJob("queued-for-later", { id: 1 });

queue.resume();

Paused queues keep accepting jobs, but they do not process waiting jobs until resume() is called.

Inspecting and Removing Jobs

const job = queue.addJob("cleanup", { path: "/tmp/report.csv" });

queue.getJob(job.id);
queue.getJobs();
queue.getActiveJobCount();

queue.removeJob(job.id);
queue.clear();

removeJob() only removes jobs that are waiting or delayed. clear() removes all jobs and schedulers and clears pending timers.

Scheduled Jobs

Use schedulers for repeated background work. Schedulers add jobs to the queue on an interval or cron expression.

Interval Scheduler

queue.upsertJobScheduler("heartbeat", {
  name: "heartbeat",
  data: { service: "api" },
  repeat: {
    strategy: "interval",
    interval: 5_000,
  },
});

Cron Scheduler

queue.upsertJobScheduler("daily-report", {
  name: "daily-report",
  data: { report: "usage" },
  repeat: {
    strategy: "cron",
    cron: "0 9 * * *",
  },
});

Cron expressions use five fields:

minute hour day-of-month month day-of-week

Supported cron syntax includes wildcards, ranges, lists, and steps, such as:

  • * * * * *
  • */5 * * * *
  • 0 9 * * 1-5
  • 0,30 * * * *

Manage schedulers with:

queue.getJobScheduler("daily-report");
queue.getJobSchedulers();
queue.removeJobScheduler("daily-report");

TypeScript

supaqueue is written in TypeScript and lets you type both job data and processor results:

type JobData = { userId: string };
type JobResult = { ok: boolean };

const queue = createQueue<JobData, JobResult>(async (job) => {
  return { ok: job.data.userId.length > 0 };
});

Notes

  • Jobs live in memory only.
  • Jobs are not shared across processes.
  • Jobs are lost when the process exits.
  • Scheduled jobs use Node.js timers.