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

node-ral

Package Overview
Dependencies
Maintainers
1
Versions
96
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-ral - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

13

lib/config.js

@@ -195,2 +195,3 @@ /**

value.serviceID = key;
contextCache[key] = {};
});

@@ -219,4 +220,12 @@ // parse conf to normalized config

var ContextClass = context.balance.getContextClass();
context.balanceContext = new ContextClass(serviceID, serviceInfo);
context.protocolContext = context.protocol.normalizeConfig(serviceInfo);
// 从缓存中获取BalanceContext避免重复创建
if (!contextCache[serviceID].balance) {
contextCache[serviceID].balance = new ContextClass(serviceID, serviceInfo);
}
context.balanceContext = contextCache[serviceID].balance;
// // 从缓存中获取ProtocolContext避免重复创建
// if (!contextCache[serviceID].protocol) {
// contextCache[serviceID].protocol = context.protocol.normalizeConfig(serviceInfo);
// }
// context.protocolContext = contextCache[serviceID].protocol;
context.packConverter = RalModule.modules.converter[options.pack || serviceInfo.pack];

@@ -223,0 +232,0 @@ context.pack = context.packConverter.pack;

18

lib/ral.js

@@ -181,4 +181,3 @@ /**

function onTimeout() {
logger.trace('request timeout');
callRetry(new Error('request time out'));
callRetry(new Error('request timeout'));
}

@@ -264,3 +263,3 @@

// set timeout
this.timeout = setTimeout(onTimeout, conf.timeout);
this.timeout = setTimeout(onTimeout.bind(me), conf.timeout);

@@ -314,5 +313,2 @@ // create a request stream

clearTimeout(this.timeout);
var info = this.getLogInfo();
info.errmsg = err.message;
logger.warning('request failed ' + info.errmsg + ralUtil.qs(info));
process.nextTick(function () {

@@ -325,6 +321,10 @@ me.emit('error', err);

clearTimeout(this.timeout);
var info = this.getLogInfo();
info.errmsg = err.message;
var msg = 'request failed, retry. errmsg=' + info.errmsg + ralUtil.qs(info);
if (!err._hasReqInfo) {
var info = this.getLogInfo();
err._hasReqInfo = true;
err.message += ' ' + ralUtil.qs(info);
}
var msg = 'request failed. errmsg=' + err.message;
logger.notice(msg);
logger.warning(msg);
this.emit('retry', err);

@@ -331,0 +331,0 @@ };

@@ -58,3 +58,3 @@ /**

catch (e) {
logger.warning('[' + pathOrModule + '] is skiped since not RalModule');
logger.notice('[' + pathOrModule + '] is skiped since not RalModule');
return;

@@ -77,3 +77,3 @@ }

else {
logger.trace('[' + pathOrModule + '] is skiped since not RalModule');
logger.notice('[' + pathOrModule + '] is skiped since not RalModule');
}

@@ -80,0 +80,0 @@ };

{
"name": "node-ral",
"version": "0.2.0",
"version": "0.2.1",
"description": "a rpc client for node",

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

@@ -199,3 +199,3 @@ /**

req.on('error', function (err) {
err.should.be.match(/request time out/);
err.message.should.be.match(/request timeout/);
done();

@@ -314,3 +314,3 @@ });

req.on('error', function (error) {
error.toString().should.be.match(/request time out/);
error.toString().should.be.match(/request timeout/);
done();

@@ -406,3 +406,3 @@ });

req.on('error', function (err) {
err.message.should.be.match(/request time out/);
err.message.should.be.match(/request timeout/);
done();

@@ -409,0 +409,0 @@ });

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