Showing
3 changed files
with
5 additions
and
5 deletions
@@ -159,7 +159,7 @@ async function handleClientTiming(scope, item) { | @@ -159,7 +159,7 @@ async function handleClientTiming(scope, item) { | ||
159 | osVersion: agent.os.toVersion() | 159 | osVersion: agent.os.toVersion() |
160 | }; | 160 | }; |
161 | 161 | ||
162 | - const ipInfo = await ipService.getIsp(scope.ip).catch(() => {}); | 162 | + const ipInfo = ipService.getIsp(scope.ip).catch(() => {}); |
163 | 163 | ||
164 | _.merge(data, ipInfo); | 164 | _.merge(data, ipInfo); |
165 | 165 |
@@ -3,7 +3,7 @@ const logger = global.yoho.logger; | @@ -3,7 +3,7 @@ const logger = global.yoho.logger; | ||
3 | 3 | ||
4 | const ipQuery = new IP2Region(); | 4 | const ipQuery = new IP2Region(); |
5 | 5 | ||
6 | -async function getIsp(ip) { | 6 | +function getIsp(ip) { |
7 | try { | 7 | try { |
8 | 8 | ||
9 | const result = ipQuery.search(ip); | 9 | const result = ipQuery.search(ip); |
@@ -15,7 +15,7 @@ async function getIsp(ip) { | @@ -15,7 +15,7 @@ async function getIsp(ip) { | ||
15 | country: result.country | 15 | country: result.country |
16 | }; | 16 | }; |
17 | } catch (e) { | 17 | } catch (e) { |
18 | - logger.error(e); | 18 | + logger.error('[ip] find ip error [%s]', e); |
19 | return {}; | 19 | return {}; |
20 | } | 20 | } |
21 | } | 21 | } |
1 | const ipApi = require('./ip-api'); | 1 | const ipApi = require('./ip-api'); |
2 | 2 | ||
3 | -async function getIsp(ip) { | 3 | +function getIsp(ip) { |
4 | if (!ip) { | 4 | if (!ip) { |
5 | return {}; | 5 | return {}; |
6 | } | 6 | } |
7 | 7 | ||
8 | - const result = await ipApi.getIsp(ip); | 8 | + const result = ipApi.getIsp(ip); |
9 | 9 | ||
10 | if (result.country === '内网IP') { | 10 | if (result.country === '内网IP') { |
11 | return {}; | 11 | return {}; |
-
Please register or login to post a comment