Skip to main content
Home

Built and signed on GitHub Actions

This package works with Node.js, Deno, BunIt is unknown whether this package works with Cloudflare Workers, Browsers
It is unknown whether this package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
It is unknown whether this package works with Browsers
JSR Score
35%
Published
a year ago (0.1.6)

jobify

npm npm downloads JSR JSR Score

Type-safe and much simpler wrapper for the BullMQ library.

Warning

This project is in the MVP state and the API may still change a lot. At the moment, the project fits the requirements of the project rather than general purpose

Usage

import { initJobify } from "jobify";
import IORedis from "ioredis";

const redis = new IORedis({
    maxRetriesPerRequest: null,
});

const defineJob = initJobify(redis);

const job1 = defineJob("some", {
    queue: {
        defaultJobOptions: {
            delay: 100,
        },
    },
})
    .input<{ date: string }>()
    // WORKER OPTIONS
    .options({
        limiter: {
            max: 10,
            duration: 1000,
        },
    })
    .action(async (job) => {
        console.log("running", job.data.date);
        //       ^?
    });

await job1.add(
    "some",
    { date: new Date().toISOString() },
    {
        delay: 5000,
    }
);

const job2 = await defineJob("some-cron")
    .input<{ date: string }>()
    .options({
        limiter: {
            max: 10,
            duration: 1000,
        },
    })
    .action(async (job) => {
        console.log("running", job.data.date);
        //       ^?
    })
    // it will run every minute and will not be duplicated during reboots.
    .repeatable({
        every: 60 * 1000,
    });

Workers defaults

We add some options by default to Workers

{
    removeOnComplete: {
		count: 20,
	},
	removeOnFail: {
		age: 24 * 3600,
		count: 1000,
    }
}

We add it because it recommended in going to production

TODO:

  • maybe pg-boss adapter?
  • hooks?
  • make job title optional?
  • guide with bull-board and some improves for usage
Built and signed on
GitHub Actions

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@kravets/jobify

Import symbol

import * as jobify from "@kravets/jobify";
or

Import directly with a jsr specifier

import * as jobify from "jsr:@kravets/jobify";

Add Package

pnpm i jsr:@kravets/jobify
or (using pnpm 10.8 or older)
pnpm dlx jsr add @kravets/jobify

Import symbol

import * as jobify from "@kravets/jobify";

Add Package

yarn add jsr:@kravets/jobify
or (using Yarn 4.8 or older)
yarn dlx jsr add @kravets/jobify

Import symbol

import * as jobify from "@kravets/jobify";

Add Package

vlt install jsr:@kravets/jobify

Import symbol

import * as jobify from "@kravets/jobify";

Add Package

npx jsr add @kravets/jobify

Import symbol

import * as jobify from "@kravets/jobify";

Add Package

bunx jsr add @kravets/jobify

Import symbol

import * as jobify from "@kravets/jobify";