Skip to content

Commit

Permalink
Fixed #5, replaced packages and npm audit is green ;)
Browse files Browse the repository at this point in the history
  • Loading branch information
LRagji committed Aug 30, 2021
1 parent 8182eaa commit debafb4
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 43 deletions.
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const shortid = require("shortid");
const Scripto = require("redis-scripto");
const _nonSecureId = require("nanoid/non-secure").nanoid;
const Scripto = require("redis-scripto2");
const path = require("path");

class StreamChannelBroker {
Expand Down Expand Up @@ -43,7 +43,7 @@ class StreamChannelBroker {
}
}

async _subscribe(groupName, consumerName, handler, pollSpan = 1000, payloadsToFetch = 2, subscriptionHandle = shortid.generate(), readPending = false) {
async _subscribe(groupName, consumerName, handler, pollSpan = 1000, payloadsToFetch = 2, subscriptionHandle = _nonSecureId(), readPending = false) {
const intervalHandle = setTimeout(async () => {
try {
const messages = await this._redisClient.xreadgroup("GROUP", groupName, consumerName, "BLOCK", pollSpan, "COUNT", payloadsToFetch, "STREAMS", this._channelName, (readPending === false ? ">" : "0"));
Expand Down
56 changes: 20 additions & 36 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
},
"homepage": "https://github.com/LRagji/redis-streams-broker#readme",
"dependencies": {
"redis-scripto": "^0.1.3",
"shortid": "^2.2.15"
"nanoid": "^3.1.25",
"redis-scripto2": "^0.2.2"
},
"devDependencies": {
"ioredis": "^4.26.0",
Expand Down
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ const consumedMem = await broker.memoryFootprint();
## Built with

1. Authors :heart for Open Source.
2. [shortid](https://www.npmjs.com/package/shortid) for auto generating subscribtion handles.
3. [redis-scripto](https://www.npmjs.com/package/redis-scripto) for handling lua scripts.
2. [nanoid](https://www.npmjs.com/package/nanoid#js) for auto generating subscribtion handles.
3. [redis-scripto2](https://www.npmjs.com/package/redis-scripto2) for handling lua scripts.

## Contributions

Expand Down

0 comments on commit debafb4

Please sign in to comment.