From 5ec951429f6de7101ab9497a47e5e77f39489519 Mon Sep 17 00:00:00 2001 From: "yuxin.zhang" Date: Fri, 10 Dec 2021 15:42:00 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E7=A7=BB=E9=99=A4blockchain-data-sync?= =?UTF-8?q?=E7=9A=84log4j2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- union/blockchain-data-sync/pom.xml | 10 --- .../src/main/resources/application.properties | 35 ++++++++ .../src/main/resources/application.yml | 41 --------- .../src/main/resources/log4j2.xml | 84 ------------------- 4 files changed, 35 insertions(+), 135 deletions(-) create mode 100644 union/blockchain-data-sync/src/main/resources/application.properties delete mode 100644 union/blockchain-data-sync/src/main/resources/application.yml delete mode 100644 union/blockchain-data-sync/src/main/resources/log4j2.xml diff --git a/union/blockchain-data-sync/pom.xml b/union/blockchain-data-sync/pom.xml index 1f72772b6..6dfbff8e6 100644 --- a/union/blockchain-data-sync/pom.xml +++ b/union/blockchain-data-sync/pom.xml @@ -32,16 +32,6 @@ com.welab.wefe common-web ${project.parent.version} - - - org.springframework.boot - spring-boot-starter-logging - - - - - org.springframework.boot - spring-boot-starter-log4j2 diff --git a/union/blockchain-data-sync/src/main/resources/application.properties b/union/blockchain-data-sync/src/main/resources/application.properties new file mode 100644 index 000000000..38aa3e080 --- /dev/null +++ b/union/blockchain-data-sync/src/main/resources/application.properties @@ -0,0 +1,35 @@ +server.port=9527 + +server.servlet.context-path=/blockchain-data-sync + + +spring.datasource.mongodb.union.uri=mongodb://user:pwd@10.**.**.**:16016/wefe_union_dev +spring.datasource.mongodb.union.databaseName=wefe_union_dev + +spring.servlet.multipart.max-request-size=30MB +spring.servlet.multipart.max-file-size=20MB + + + + +sdk.corePoolSize=50 +sdk.maxPoolSize=100 +sdk.queueCapacity=100 +sdk.ip=10.**.**.** +sdk.channelPort=20200 +sdk.certPath=**/**/dev_config + +contract.data-sync-group-id=1 +contract.solidity-path=**/**/solidity + + +wechat.bot-url=https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key= + + + +logging.file=/data/logs/blockchain-data-sync/blockchain-data-sync.log +logging.level.root=info +logging.file.max-history=60 +logging.file.max-size=20GB +logging.pattern.console=%clr(%d{${LOG_DATEFORMAT_PATTERN:-yyyy-MM-dd HH:mm:ss.SSS}}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) [%X{requestId}] %clr([%15.15t]){faint} %clr(%-40.40logger{39}[%F:%L]){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx} +logging.pattern.file=%d{yyyy-MM-dd HH:mm:ss.SSS} [%level] [%X{requestId}] ${PID:- } [%15.15t] %-40.40logger{39}[%F:%L] : %m%n diff --git a/union/blockchain-data-sync/src/main/resources/application.yml b/union/blockchain-data-sync/src/main/resources/application.yml deleted file mode 100644 index 74185d26a..000000000 --- a/union/blockchain-data-sync/src/main/resources/application.yml +++ /dev/null @@ -1,41 +0,0 @@ -spring: - datasource: - mongodb: - uri: mongodb://wefe:********@*.1.0.*:37017/wefe_union - databaseName: wefe_union - - servlet: - multipart: - max-request-size: 30MB - max-file-size: 20MB - - -server: - port: 9527 - tomcat: - max-threads: 200 - max-connections: 10000 - servlet: - context-path: /blockchain-data-sync - -sdk: - corePoolSize: 50 - maxPoolSize: 100 - queueCapacity: 100 - ip: 10.**.**.87 - channelPort: 20200 - certPath: xx/xx/cert # cert path of relative or absolute - - -logging: - config: classpath:log4j2.xml - level: - com.welab.wefe: info - - -wechat: - bot-url: https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key= - -contract: - data-sync-group-id: 1 - solidity-path: union/blockchain-data-sync/solidity diff --git a/union/blockchain-data-sync/src/main/resources/log4j2.xml b/union/blockchain-data-sync/src/main/resources/log4j2.xml deleted file mode 100644 index f32183bea..000000000 --- a/union/blockchain-data-sync/src/main/resources/log4j2.xml +++ /dev/null @@ -1,84 +0,0 @@ - - - - ./log - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file -- Gitee From b9af194897c68cfefab6fbfc1f15e53b01c9a444 Mon Sep 17 00:00:00 2001 From: "claude.wu" Date: Tue, 14 Dec 2021 11:44:36 +0800 Subject: [PATCH 2/4] =?UTF-8?q?fix:=20chatroom=20=E5=AD=98=E5=82=A8?= =?UTF-8?q?=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- board/board-website/src/components/ChatUI/ChatUI.vue | 2 +- board/board-website/src/components/LayoutBase.vue | 11 ++++++----- board/board-website/src/components/LayoutHeader.vue | 2 +- board/board-website/src/components/LoginDialog.vue | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/board/board-website/src/components/ChatUI/ChatUI.vue b/board/board-website/src/components/ChatUI/ChatUI.vue index 8944fb86b..dfe7169df 100644 --- a/board/board-website/src/components/ChatUI/ChatUI.vue +++ b/board/board-website/src/components/ChatUI/ChatUI.vue @@ -194,7 +194,7 @@ console.log('hide'); vData.dom.classList.add('hide'); vData.dom.classList.remove('show'); - window.localStorage.removeItem(`${window.api.prefixPath}_chat`); + window.localStorage.removeItem(`${window.api.baseUrl}_chat`); }; // show chat room diff --git a/board/board-website/src/components/LayoutBase.vue b/board/board-website/src/components/LayoutBase.vue index 94c3ac7b4..22138e1f1 100644 --- a/board/board-website/src/components/LayoutBase.vue +++ b/board/board-website/src/components/LayoutBase.vue @@ -119,7 +119,7 @@ }; // open chat room const startChart = () => { - if (window.localStorage.getItem(`${window.api.prefixPath}_chat`) === 'connect') { + if (window.localStorage.getItem(`${window.api.baseUrl}_chat`) === 'connect') { nextTick(async () => { chatui.value.show(); restartWs(); @@ -129,7 +129,8 @@ const restartWs = () => { if(vData.ws) return; - const url = process.env.NODE_ENV === 'production' ? `wss://${window.api.baseUrl.replace(/http(s?):\/\//, '')}` : 'wss://xxx.wolaidai.com/board-service-04'; // ws://xxx:8080/board-service-01 // wss://xxx.wolaidai.com/board-service-01 + const protocol = window.api.baseUrl.replace(/^http/, 'ws'); + const url = process.env.NODE_ENV === 'production' ? protocol : 'wss://xxx.wolaidai.com/board-service-04'; // ws://xxx:8080/board-service-01 // wss://xxx.wolaidai.com/board-service-01 const websocket = new WebSocket(`${url}/chatserver/${userInfo.value.token}`); websocket.addEventListener('open', ev => { @@ -172,8 +173,8 @@ provide('refresh', methods.refresh); onBeforeMount(() => { - const { prefixPath } = window.api; - const asideCollapsedKey = `${prefixPath}AsideCollapsed`; + const { baseUrl } = window.api; + const asideCollapsedKey = `${baseUrl}AsideCollapsed`; // collapsed left menus const $isCollapsed = window.localStorage.getItem(asideCollapsedKey); @@ -191,7 +192,7 @@ }); // check last state - if (window.localStorage.getItem(`${prefixPath}chat`) === 'connect') { + if (window.localStorage.getItem(`${baseUrl}_chat`) === 'connect') { startChart(); } }); diff --git a/board/board-website/src/components/LayoutHeader.vue b/board/board-website/src/components/LayoutHeader.vue index 5a83ab50b..2a5a5fcb3 100644 --- a/board/board-website/src/components/LayoutHeader.vue +++ b/board/board-website/src/components/LayoutHeader.vue @@ -229,7 +229,7 @@ }; // chat connection const getConnect = () => { - const key = `${window.api.prefixPath}_chat`; + const key = `${window.api.baseUrl}_chat`; const inited = window.localStorage.getItem(key); if(inited !== 'connect') { diff --git a/board/board-website/src/components/LoginDialog.vue b/board/board-website/src/components/LoginDialog.vue index f3d7dbaf7..1c6c97189 100644 --- a/board/board-website/src/components/LoginDialog.vue +++ b/board/board-website/src/components/LoginDialog.vue @@ -91,7 +91,7 @@ created () { this.$bus.$on('show-login-dialog', () => { // hide the chat room - window.localStorage.setItem(`${window.api.prefixPath}_chat`, 'disconnect'); + window.localStorage.setItem(`${window.api.baseUrl}_chat`, 'disconnect'); this.$store.commit('SYSTEM_INITED', false); this.form.code = ''; this.show = true; -- Gitee From 0b626f6659bb7df689f709b31967e1629dc1c6f6 Mon Sep 17 00:00:00 2001 From: "yuxin.zhang" Date: Fri, 24 Dec 2021 15:30:48 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E7=A8=8B=E5=BA=8F=EF=BC=8C=E5=A6=82=E6=9E=9C=E5=9D=97=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E4=B8=BA=E7=A9=BA=E6=96=B0=E5=A2=9E=20=E9=87=8D?= =?UTF-8?q?=E8=AF=95=E6=9C=BA=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/welab/wefe/task/DataSyncTask.java | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/union/blockchain-data-sync/src/main/java/com/welab/wefe/task/DataSyncTask.java b/union/blockchain-data-sync/src/main/java/com/welab/wefe/task/DataSyncTask.java index 524521736..1a0e225ec 100644 --- a/union/blockchain-data-sync/src/main/java/com/welab/wefe/task/DataSyncTask.java +++ b/union/blockchain-data-sync/src/main/java/com/welab/wefe/task/DataSyncTask.java @@ -156,19 +156,27 @@ public class DataSyncTask { * Sync block data */ private void startSync(long blockNumber) throws Exception { - // get block by block number - BcosBlock.Block block = BlockUtil.getBlock(this.client, new BigInteger(String.valueOf(blockNumber))); - BlockInfoBO blockInfoBO = BlockInfoParser.create(block).parse(); + for (int i = 0; i < 6; i++) { + // get block by block number + BcosBlock.Block block = BlockUtil.getBlock(this.client, new BigInteger(String.valueOf(blockNumber))); + BlockInfoBO blockInfoBO = BlockInfoParser.create(block).parse(); + + if (CollectionUtils.isEmpty(blockInfoBO.getEventBOList())) { + // retry + Thread.sleep(500); + continue; + } - BlockInfoBO filterBlockInfoBO = filterBlockInfoBO(blockInfoBO); + BlockInfoBO filterBlockInfoBO = filterBlockInfoBO(blockInfoBO); - DataProcessor.parseBlockData(filterBlockInfoBO); + DataProcessor.parseBlockData(filterBlockInfoBO); - saveBlockSyncHeight(blockInfoBO); + saveBlockSyncHeight(blockInfoBO); - saveBlockSyncContractHeight(filterBlockInfoBO); + saveBlockSyncContractHeight(filterBlockInfoBO); - saveBlockDetailInfo(blockInfoBO); + saveBlockDetailInfo(blockInfoBO); + } } /** -- Gitee From c84fc50a7619a1ff6c6e84045f4ee1f738e6eaba Mon Sep 17 00:00:00 2001 From: "hunter.zhao" <7GHMDBCENU5H> Date: Mon, 27 Dec 2021 11:22:47 +0800 Subject: [PATCH 4/4] =?UTF-8?q?wefe-serving=E9=80=BB=E8=BE=91=E5=9B=9E?= =?UTF-8?q?=E5=BD=92=E4=BF=AE=E6=94=B9=E5=88=86=E6=95=B0=E5=8F=96=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../welab/wefe/serving/sdk/algorithm/AbstractAlgorithm.java | 2 +- .../sdk/algorithm/lr/single/LrVertPromoterAlgorithm.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/serving/serving-sdk-java/src/main/java/com/welab/wefe/serving/sdk/algorithm/AbstractAlgorithm.java b/serving/serving-sdk-java/src/main/java/com/welab/wefe/serving/sdk/algorithm/AbstractAlgorithm.java index b1c059545..15307e164 100644 --- a/serving/serving-sdk-java/src/main/java/com/welab/wefe/serving/sdk/algorithm/AbstractAlgorithm.java +++ b/serving/serving-sdk-java/src/main/java/com/welab/wefe/serving/sdk/algorithm/AbstractAlgorithm.java @@ -55,7 +55,7 @@ public abstract class AbstractAlgorithm { * single sigmod function */ protected PredictModel sigmod(PredictModel model) { - model.setData(1. / (1. + exp(-Double.valueOf(model.getData().toString())))); + model.setScore(1. / (1. + exp(-model.getScore()))); return model; } diff --git a/serving/serving-sdk-java/src/main/java/com/welab/wefe/serving/sdk/algorithm/lr/single/LrVertPromoterAlgorithm.java b/serving/serving-sdk-java/src/main/java/com/welab/wefe/serving/sdk/algorithm/lr/single/LrVertPromoterAlgorithm.java index 83de67809..79c96f0ca 100644 --- a/serving/serving-sdk-java/src/main/java/com/welab/wefe/serving/sdk/algorithm/lr/single/LrVertPromoterAlgorithm.java +++ b/serving/serving-sdk-java/src/main/java/com/welab/wefe/serving/sdk/algorithm/lr/single/LrVertPromoterAlgorithm.java @@ -55,8 +55,8 @@ public class LrVertPromoterAlgorithm extends AbstractLrAlgorithm