New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@nerimity/mimiqueue

Package Overview
Dependencies
Maintainers
0
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nerimity/mimiqueue - npm Package Compare versions

Comparing version 1.0.3 to 1.1.0

altExample.mjs

2

package.json
{
"name": "@nerimity/mimiqueue",
"version": "1.0.3",
"version": "1.1.0",
"description": "NodeJS group queuing library. Requires Redis.",

@@ -5,0 +5,0 @@ "main": "dist/index.mjs",

@@ -45,1 +45,34 @@ # Mimiqueue

```
## Alt Usage
```ts
import { createClient } from "redis";
import { AltQueue } from "@nerimity/mimiqueue";
import { setTimeout } from "timers/promises";
const redisClient = createClient({
socket: {
host: "127.0.0.1",
port: 6379,
},
});
await redisClient.connect();
await redisClient.flushAll();
const queue = new AltQueue({
redisClient,
name: "addFriend",
});
async function doSomething(groupName) {
const done = await queue.start({ groupName });
console.log("doing something");
await setTimeout(1000);
done();
}
doSomething("123");
doSomething("123");
```
export * from "./Queue";
export * from "./AltQueue";

@@ -140,18 +140,2 @@ import { createClient } from "redis";

function waitJobCount(queue: Queue, id: number, groupName?: string) {
let key = `${queue.prefix}:${queue.name}`;
if (groupName) key += `:${groupName}`;
key += ":wait";
return queue.redisClient.lLen(key);
}
function activeJobCount(queue: Queue, groupName?: string) {
let key = `${queue.prefix}:${queue.name}`;
if (groupName) key += `:${groupName}`;
key += ":active";
return queue.redisClient.lLen(key);
}
function addJobToActive(queue: Queue, id: number | string, groupName?: string) {

@@ -162,3 +146,3 @@ let key = `${queue.prefix}:${queue.name}`;

return queue.redisClient.rPush(key, id.toString());
return queue.redisClient.set(key, id.toString());
}

@@ -171,3 +155,3 @@

const multi = queue.redisClient.multi();
multi.lLen(`${key}:active`);
multi.get(`${key}:active`);
multi.lLen(`${key}:wait`);

@@ -177,3 +161,3 @@

return active + wait;
return (active ? 1 : 0) + wait;
}

@@ -197,3 +181,3 @@

multi.lRem(key1, 1, id.toString());
multi.del(key1);
multi.del(key2);

@@ -200,0 +184,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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