Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jobify

Package Overview
Dependencies
Maintainers
0
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jobify

Right way to work with jobs

  • 0.0.1
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

jobify

npm 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")
    .input<{ date: string }>()
    .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(
        { date: new Date().toISOString() },
        {
            pattern: "* * * * *",
        }
    );

TODO:

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

Keywords

FAQs

Package last updated on 24 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc