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 🙏

© 2024 – Pkg Stats / Ryan Hefner

minwq

v3.0.0

Published

Minimalist work queue backed by Redis

Downloads

48

Readme

minwq

Minimalistic Node.JS Work Queue, backed by Redis. (>=2.6.* redis required with Lua support)

npm install minwq

##Usage var minwq = require("minwq")

// Create a new store
var store= new minwq([options]);

// Optional
// You can provide a queue suffix for all jobs for namespacing purposes.
var store = new minwq({
	prefix: "myapp",
});

// If you need to provide custom redis clients (due to authentication or because you just want to), you can override createClient function of store;
minwq.prototype.createClient = function() {
	return redis.createClient(..whatever);
}

Pushing - Push a new job to a queue

  • queue [required] - Name of the queue
  • data [required] - Job payload
  • delay [optional] - Delay job execution (in milliseconds)
  • unique [optional] - If provided, only a single living job can have the unqiue token, additional push requests will fail.
  • replace [optional] - Boolean. If a unique key is provided and a duplicate job is pushed, it is ignored by default. Provide replace: true to replace the older job with new one.
  • callback(err, jobid) - Gets called when the job is created

store.push({
	queue: "email",
	data: {
		to: "[email protected]",
		subject: "Foo",
		text: "Bar"
	},
	delay: 100,
	unique: "unqiue token",
}, callback);

Poping - Pop a job from queue

  • ttl [optional] - Job retry delay (in milliseconds).

If a job takes more than ttl milliseconds to complete, it will be requeued. No TTL means the hob will be removed from queue immediately when the pop function gets called.


store.pop({
	queue: "email",
	ttl: 10000
}, function(err, job) {
	// job.data contains the job payload
	console.log(job.data);

	// after finishing the job, you need to remove it explicitly from the queue:
	job.remove(callback);
});

##license MIT