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

@cap-js-community/event-queue

Package Overview
Dependencies
Maintainers
6
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cap-js-community/event-queue - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

2

package.json
{
"name": "@cap-js-community/event-queue",
"version": "0.2.0",
"version": "0.2.1",
"description": "An event queue that enables secure transactional processing of asynchronous events, featuring instant event processing with Redis Pub/Sub and load distribution across all application instances.",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -6,3 +6,3 @@ # @cap-js-community/event-queue

[![REUSE status](https://api.reuse.software/badge/github.com/cap-js-community/event-queue)](https://api.reuse.software/info/github.com/cap-js-community/event-queue)
[![CI Main](https://github.com/cap-js-community/event-queue/actions/workflows/ci-main.yml/badge.svg)](https://github.com/cap-js-community/event-queue/commits/main)
[![CI Main](https://github.com/cap-js-community/event-queue/actions/workflows/main-ci.yml/badge.svg)](https://github.com/cap-js-community/event-queue/commits/main)

@@ -9,0 +9,0 @@ The Event-Queue is a framework built on top of CAP Node.js, specifically designed to enable efficient and streamlined

@@ -15,3 +15,4 @@ "use strict";

const { getConfigInstance } = require("./config");
const { initEventQueueRedisSubscribe } = require("./redisPubSub");
const { initEventQueueRedisSubscribe, closeSubscribeClient } = require("./redisPubSub");
const { closeMainClient } = require("./shared/redis");

@@ -86,2 +87,3 @@ const readFileAsync = promisify(fs.readFile);

registerEventProcessors();
registerCdsShutdown();
logger.info("event queue initialized", {

@@ -186,4 +188,10 @@ registerAsEventProcessor: configInstance.registerAsEventProcessor,

const registerCdsShutdown = () => {
cds.on("shutdown", async () => {
await Promise.allSettled([closeMainClient(), closeSubscribeClient()]);
});
};
module.exports = {
initialize,
};

@@ -70,5 +70,17 @@ "use strict";

const closeSubscribeClient = async () => {
try {
const client = await subscriberClientPromise;
if (client?.quit) {
await client.quit();
}
} catch (err) {
// ignore errors during shutdown
}
};
module.exports = {
initEventQueueRedisSubscribe,
broadcastEvent,
closeSubscribeClient,
};

@@ -32,5 +32,14 @@ "use strict";

const credentials = env.getRedisCredentialsFromEnv();
// NOTE: settings the user explicitly to empty resolves auth problems, see
// https://github.com/go-redis/redis/issues/1343
const redisIsCluster = credentials.cluster_mode;
const url = credentials.uri.replace(/(?<=rediss:\/\/)[\w-]+?(?=:)/, "");
if (redisIsCluster) {
return redis.createCluster({
rootNodes: [{ url }],
// https://github.com/redis/node-redis/issues/1782
defaults: {
password: credentials.password,
socket: { tls: credentials.tls },
},
});
}
return redis.createClient({ url });

@@ -91,2 +100,13 @@ } catch (err) {

const closeMainClient = async () => {
try {
const client = await mainClientPromise;
if (client?.quit) {
await client.quit();
}
} catch (err) {
// ignore errors during shutdown
}
};
module.exports = {

@@ -97,2 +117,3 @@ createClientAndConnect,

publishMessage,
closeMainClient,
};
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