Socket
Socket
Sign inDemoInstall

egg-redis

Package Overview
Dependencies
25
Maintainers
3
Versions
15
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.0 to 2.0.1

4

config/config.default.js

@@ -8,2 +8,6 @@ 'use strict';

agent: false,
// redis client will try to use TIME command to detect client is ready or not
// if your redis server not support TIME command, please set this config to false
// see https://redis.io/commands/time
supportTimeCommand: true,

@@ -10,0 +14,0 @@ // Single Redis

2.0.1 / 2018-11-28
==================
**fixes**
* [[`fbfbbfa`](http://github.com/eggjs/egg-redis/commit/fbfbbfabe4650a529f2d2d46983e1b05df1fb347)] - fix: show real redis server time by TIME command (#20) (fengmk2 <<fengmk2@gmail.com>>)
2.0.0 / 2018-02-27

@@ -3,0 +9,0 @@ ==================

42

lib/redis.js

@@ -11,3 +11,2 @@ 'use strict';

let count = 0;
function createClient(config, app) {

@@ -23,32 +22,31 @@ let client;

});
app.coreLogger.info('[egg-redis] cluster connecting start');
app.coreLogger.info('[egg-redis] cluster connecting');
client = new Redis.Cluster(config.nodes, config);
client.on('connect', function() {
app.coreLogger.info('[egg-redis] cluster connect success');
});
client.on('error', function(error) {
app.coreLogger.error(error);
});
} else {
assert(config.host && config.port && config.password !== undefined && config.db !== undefined,
`[egg-redis] 'host: ${config.host}', 'port: ${config.port}', 'password: ${config.password}', 'db: ${config.db}' are required on config`);
app.coreLogger.info('[egg-redis] connecting redis://:%s@%s:%s/%s',
config.password, config.host, config.port, config.db);
app.coreLogger.info('[egg-redis] server connecting redis://:***@%s:%s/%s',
config.host, config.port, config.db);
client = new Redis(config);
client.on('connect', function() {
app.coreLogger.info('[egg-redis] connect success on redis://:%s@%s:%s/%s',
config.password, config.host, config.port, config.db);
});
client.on('error', function(error) {
app.coreLogger.error(error);
});
}
client.on('connect', () => {
app.coreLogger.info('[egg-redis] client connect success');
});
client.on('error', err => {
app.coreLogger.error('[egg-redis] client error: %s', err);
app.coreLogger.error(err);
});
app.beforeStart(async () => {
const result = await client.info();
const index = count++;
app.coreLogger.info(`[egg-redis] instance[${index}] status OK, redis currentTime: ${result[0]}`);
if (app.config.redis.supportTimeCommand) {
const serverTimes = await client.time();
// [ '1543378095', '393297' ]
const dateTime = new Date(Number(String(serverTimes[0]) + String(serverTimes[1]).substring(0, 3)));
app.coreLogger.info(`[egg-redis] instance[${index}] status OK, redis server currentTime: ${dateTime}`);
} else {
await client.get('egg-redis-hello');
app.coreLogger.info(`[egg-redis] instance[${index}] status OK, client ready`);
}
});

@@ -55,0 +53,0 @@

{
"name": "egg-redis",
"version": "2.0.0",
"version": "2.0.1",
"description": "Redis plugin for egg",

@@ -48,3 +48,3 @@ "eggPlugin": {

"type": "travis",
"version": "8, 9",
"version": "8, 10, 11",
"license": true,

@@ -51,0 +51,0 @@ "services": "redis-server"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc