@be-link/ecommerce-product-service-node-sdk 0.1.13 → 0.1.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,8 +7,8 @@ export default abstract class BaseService {
7
7
  /** URL一级路径 */
8
8
  protected abstract prefixUrl: string;
9
9
  /** 子网域名 */
10
- protected readonly natDevHost = "http://product:8090/product-service";
11
- protected readonly natProdHost = "http://product:8090/product-service";
10
+ protected readonly natDevHost = "http://192.168.18.162:8090/product-service";
11
+ protected readonly natProdHost = "http://192.168.84.27:8090/product-service";
12
12
  /** 公网域名 */
13
13
  protected readonly publicDevHost = "https://ecommerce-dev.wejourney.top/product-service";
14
14
  protected readonly publicProdHost = "";
@@ -12,8 +12,8 @@ const string_1 = require("../utils/string");
12
12
  class BaseService {
13
13
  constructor() {
14
14
  /** 子网域名 */
15
- this.natDevHost = 'http://product:8090/product-service';
16
- this.natProdHost = 'http://product:8090/product-service';
15
+ this.natDevHost = 'http://192.168.18.162:8090/product-service';
16
+ this.natProdHost = 'http://192.168.84.27:8090/product-service';
17
17
  /** 公网域名 */
18
18
  this.publicDevHost = 'https://ecommerce-dev.wejourney.top/product-service';
19
19
  this.publicProdHost = '';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@be-link/ecommerce-product-service-node-sdk",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
4
4
  "description": "EcommerceProductService Node.js SDK",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
package/utils/http.js CHANGED
@@ -42,6 +42,23 @@ const uuid_1 = require("uuid");
42
42
  const axios_retry_1 = __importDefault(require("axios-retry"));
43
43
  const request_context_1 = require("@fastify/request-context");
44
44
  const safe_stable_stringify_1 = __importDefault(require("safe-stable-stringify"));
45
+ const http_1 = __importDefault(require("http"));
46
+ const https_1 = __importDefault(require("https"));
47
+ // 配置连接池
48
+ const httpAgent = new http_1.default.Agent({
49
+ keepAlive: true,
50
+ keepAliveMsecs: 30000, // 保持连接30秒
51
+ maxSockets: 100, // 每个主机最大并发连接数
52
+ maxFreeSockets: 10, // 空闲连接池大小
53
+ timeout: 60000, // socket 超时时间
54
+ });
55
+ const httpsAgent = new https_1.default.Agent({
56
+ keepAlive: true,
57
+ keepAliveMsecs: 30000,
58
+ maxSockets: 100,
59
+ maxFreeSockets: 10,
60
+ timeout: 60000,
61
+ });
45
62
  (0, axios_retry_1.default)(axios_1.default, {
46
63
  retries: 1,
47
64
  retryCondition(error) {
@@ -69,6 +86,9 @@ async function callApi(url, request) {
69
86
  'x-belink-userid': beLinkUserId,
70
87
  'x-belink-pandora-roleid': pandoraRoleId,
71
88
  },
89
+ timeout: 3000,
90
+ httpAgent,
91
+ httpsAgent,
72
92
  });
73
93
  const responseData = response.data;
74
94
  return responseData.data;