From 701c79f3e2688c87c0a14b2420f129dab56bd155 Mon Sep 17 00:00:00 2001 From: luke <123917244@qq.com> Date: Tue, 24 Sep 2024 10:58:34 +0800 Subject: [PATCH 1/2] feat: add log --- packages/network-support/package.json | 2 +- packages/network-support/src/fetch.ts | 3 ++- packages/network-support/src/orderManager.ts | 18 +++++++++++++++++- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/packages/network-support/package.json b/packages/network-support/package.json index 64725053..7da345e0 100644 --- a/packages/network-support/package.json +++ b/packages/network-support/package.json @@ -1,6 +1,6 @@ { "name": "@subql/network-support", - "version": "1.3.1-12", + "version": "1.3.1-13", "main": "dist/index.js", "author": "SubQuery Pte Limited", "license": "Apache-2.0", diff --git a/packages/network-support/src/fetch.ts b/packages/network-support/src/fetch.ts index 2bcb1647..a8e05815 100644 --- a/packages/network-support/src/fetch.ts +++ b/packages/network-support/src/fetch.ts @@ -119,7 +119,8 @@ export function createFetch( [res] = orderManager.extractChannelState( await _res.text(), new Headers(_res.headers), - channelId + channelId, + requestId ); } if (type === OrderType.agreement) { diff --git a/packages/network-support/src/orderManager.ts b/packages/network-support/src/orderManager.ts index fe5632ab..b5248fc2 100644 --- a/packages/network-support/src/orderManager.ts +++ b/packages/network-support/src/orderManager.ts @@ -265,7 +265,8 @@ export class OrderManager { extractChannelState( payload: string | object, headers: Headers, - channelId?: string + channelId?: string, + requestId?: string ): [object, State | ChannelState, string] { switch (headers.get('X-Indexer-Response-Format')) { case ResponseFormat.Wrapped: { @@ -290,15 +291,30 @@ export class OrderManager { if (channelId) this.syncChannelState(channelId, state); const _signature = headers.get('X-Indexer-Sig') || ''; // assert(_signature, 'invalid response, missing channel signature'); + this.logger?.info({ + type: 'inline', + requestId, + data: payload, + }); return [typeof payload === 'string' ? JSON.parse(payload) : payload, state, _signature]; } case undefined: { + this.logger?.info({ + type: 'headerUndef', + requestId, + data: payload, + }); const body = typeof payload === 'string' ? JSON.parse(payload) : payload; const state = body.state; if (channelId) this.syncChannelState(channelId, state); return [body, state, '']; } default: + this.logger?.info({ + type: 'headerNull', + requestId, + data: payload, + }); if (typeof payload === 'string') { payload = JSON.parse(payload); } From 94b634b20b93bb715d4a429e2c8a5ac8da0d9e26 Mon Sep 17 00:00:00 2001 From: luke <123917244@qq.com> Date: Tue, 24 Sep 2024 11:00:54 +0800 Subject: [PATCH 2/2] feat: revert version --- packages/network-support/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/network-support/package.json b/packages/network-support/package.json index 7da345e0..64725053 100644 --- a/packages/network-support/package.json +++ b/packages/network-support/package.json @@ -1,6 +1,6 @@ { "name": "@subql/network-support", - "version": "1.3.1-13", + "version": "1.3.1-12", "main": "dist/index.js", "author": "SubQuery Pte Limited", "license": "Apache-2.0",