Skip to content

Commit

Permalink
ral: use setImmediate for better event loop
Browse files Browse the repository at this point in the history
  • Loading branch information
hefangshi committed Dec 3, 2015
1 parent 2aaba71 commit 171c696
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/ext/protocol/httpProtocolBase.js
Expand Up @@ -146,7 +146,7 @@ HttpProtocolBase.prototype._request = function (config, callback) {
}
else {
// auto end if no pipe
process.nextTick(function () {
setImmediate(function () {
piped || req.end();
});
}
Expand Down
2 changes: 1 addition & 1 deletion lib/ext/protocol/soapProtocol.js
Expand Up @@ -65,7 +65,7 @@ SoapProtocol.prototype._request = function (config, callback) {
if (!clientCache[config.wsdl] || config.noClientCache) {
soap.createClient(config.wsdl, config.options || {}, function (err, client) {
if (err) {
process.nextTick(function () {
setImmediate(function () {
req.emit('error', err);
});
return;
Expand Down
4 changes: 2 additions & 2 deletions lib/ral.js
Expand Up @@ -333,7 +333,7 @@ RalRunner.prototype.throwError = function (err) {
val = degrade(me.conf);
}
catch (e) {
return process.nextTick(function () {
return setImmediate(function () {
me.emit('error', e);
});
}
Expand All @@ -347,7 +347,7 @@ RalRunner.prototype.throwError = function (err) {
return;
}
}
process.nextTick(function () {
setImmediate(function () {
me.emit('error', err);
});
};
Expand Down

0 comments on commit 171c696

Please sign in to comment.