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

systemic-redis

Package Overview
Dependencies
Maintainers
4
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

systemic-redis - npm Package Compare versions

Comparing version 3.0.1 to 3.0.2

17

CHANGELOG.md

@@ -5,2 +5,19 @@ # Changelog

### [3.0.2](https://github.com/guidesmiths/systemic-redis/compare/v3.0.1...v3.0.2) (2022-10-31)
### ☁️ CI
* matrix strategy max parallel one ([55a12ce](https://github.com/guidesmiths/systemic-redis/commit/55a12cefdb126f0aa349c1e8f9c679947223aec7))
### 🐛 Bug Fixes
* conencted logger ([a91d23d](https://github.com/guidesmiths/systemic-redis/commit/a91d23d85f04eede04274426b74870c0f5e58fc7))
* general logger usage ([cfc6c98](https://github.com/guidesmiths/systemic-redis/commit/cfc6c98d75ee68c0c90c5c8640910ccce4eca113))
* missing reconnect strategy ([df08629](https://github.com/guidesmiths/systemic-redis/commit/df08629df24b86e06e284a5c9c80cf17d7cd4e4a))
* reconnect attempt use logger ([b3130ec](https://github.com/guidesmiths/systemic-redis/commit/b3130ecff330fef9c3f7777bcf8566f43d6fdf26))
* refactor wrong error message ([06e008e](https://github.com/guidesmiths/systemic-redis/commit/06e008eeb48b2c773059e10caf0a371ba6262380))
* replace console info logs ([45481c6](https://github.com/guidesmiths/systemic-redis/commit/45481c6479f407fab000adae8d1cfab3b420df13))
### [3.0.1](https://github.com/guidesmiths/systemic-redis/compare/v3.0.0...v3.0.1) (2022-09-19)

@@ -7,0 +24,0 @@

26

index.js

@@ -32,2 +32,6 @@ const debug = require('debug')('systemic:redis');

keepAlive: 5000,
reconnectStrategy: retries => {
logger.info(`Reconnect attempt ${retries}`);
return 4000;
}
};

@@ -40,3 +44,2 @@ if (config.tls) {

const url = protocol + host + ':' + config.port + '/' + database;
logger.info(`Connecting ${url}`);
client = redis.createClient({

@@ -48,2 +51,23 @@ url,

client.on('connect', () => {
logger.info(`Try connecting ${url}`);
});
client.on('ready', () => {
logger.info(`Connected ${url}`);
});
// Without handling incoming server errors the process would get finished
client.on('error', error => {
if (error.message === 'ERR invalid password') {
throw error;
}
logger.error(`Client err: ${JSON.stringify(error)}`);
});
client.on('reconnecting', () => {
logger.info(`Redis client is reconnecting to ${url}...`)
});
if (config.no_ready_check) {

@@ -50,0 +74,0 @@ connectToRedis();

5

package.json
{
"name": "systemic-redis",
"version": "3.0.1",
"version": "3.0.2",
"description": "A systemic redis component",

@@ -14,3 +14,3 @@ "main": "index.js",

"lint:fix": "npm run lint -- --fix",
"test": "npx jest",
"test": "npx jest --forceExit",
"docker:start": "docker-compose up -d",

@@ -34,2 +34,3 @@ "docker:stop": "docker-compose down",

"commit-and-tag-version": "^10.1.0",
"docker-compose": "^0.23.17",
"eslint": "^8.23.1",

@@ -36,0 +37,0 @@ "husky": "^8.0.1",

@@ -0,3 +1,5 @@

jest.setTimeout(15000);
const systemImage = require('./system');
const redisSystem = require('../index');
const dockerCompose = require('docker-compose');

@@ -15,3 +17,3 @@ describe('systemic-redis', () => {

} catch (error) {
expect(error.message).toBe('Unhandled error. ([ErrorReply: ERR Client sent AUTH, but no password is set])');
expect(error.message).toBe('ERR invalid password');
}

@@ -26,3 +28,3 @@ });

it('defaults', async () => {
system.set('config', { host: 'localhost', port: 6379 });
system.set('config', { host: 'localhost', password: 'systemic-redis-defaults', port: 6379 });
system.set('redis', redisSystem()).dependsOn('config');

@@ -46,3 +48,19 @@ const { redis: instance } = await system.start();

});
it('reconnect strategy', async () => {
system.set('config', { host: 'localhost', password: 'systemic-redis-defaults', port: 6379 });
system.set('redis', redisSystem()).dependsOn('config');
const { redis: instance } = await system.start();
expect(await instance.set('test', 'jest')).toBe('OK');
expect(await instance.get('test')).toBe('jest');
// Shutting down both redis servers for disconnecting clients
await dockerCompose.down();
// Not needed to wait until the redis container is up
dockerCompose.upAll();
// That would mean redis server has been restarted and client instance reconnected successfully
expect(await instance.get('test')).toBe(null);
});
});
});

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