Skip to content

Commit 02425fe

Browse files
authored
Update failureProcess.ts
1 parent 14059db commit 02425fe

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/pinus-rpc/lib/rpc-client/failureProcess.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ let failover = function (this: any, code: number, tracer: {servers: object}, ser
7272
self.dispatch.call(self, tracer, servers[0], msg, opts, cb);
7373
};
7474

75+
let __tmpTracer = {}
76+
7577
/**
7678
* Failsafe rpc failure process.
7779
*
@@ -88,7 +90,9 @@ let failsafe = function (this: any, code: number, tracer: {[key: string]: any},
8890
let self = this;
8991
let retryTimes = opts.retryTimes || constants.DEFAULT_PARAM.FAILSAFE_RETRIES;
9092
let retryConnectTime = opts.retryConnectTime || constants.DEFAULT_PARAM.FAILSAFE_CONNECT_TIME;
91-
93+
if (!tracer) {
94+
tracer = __tmpTracer;
95+
}
9296
if (!tracer.retryTimes) {
9397
tracer.retryTimes = 1;
9498
} else {
@@ -157,4 +161,4 @@ let failback = function (code: number, tracer: {[key: string]: any}, serverId: s
157161
let failfast = function (code: number, tracer: {[key: string]: any}, serverId: string, msg: {serverType: string}, opts: {[key: string]: any}, cb: Function) {
158162
logger.error('rpc failed with error, remote server: %s, msg: %j, error code: %s', serverId, msg, code);
159163
cb && cb(new Error('rpc failed with error code: ' + code));
160-
};
164+
};

0 commit comments

Comments
 (0)