Commit ef3a0a68 authored by jianhua.zhang's avatar jianhua.zhang

统计区块大小功能调整

parent 2400d4b3
......@@ -53,7 +53,7 @@ public class BlockDataFetcher<T> extends AbstractJob implements IBlockDataFetche
num = Long.valueOf(blockNumStr);
TronResponseData data = tronService.getBlockByNum(num);
if (data != null) {
log.info("已抓取数据区块高度 num:{}", num);
//log.info("已抓取数据区块高度 num:{}", num);
dataList.add(data);
}
}
......
......@@ -20,7 +20,7 @@ import java.util.concurrent.atomic.AtomicInteger;
@Slf4j
public class Executor {
private static final int SIZE = 5;
private static final int SIZE = 6;
private final List<AbstractJob> jobList = new ArrayList<>();
private final String name;
private ThreadPoolExecutor pool;
......
......@@ -26,10 +26,10 @@ public class PersistThreadPoolV2 {
private PersistThreadPoolV2() {
for (int i = 0; i < POLL_SIZE; i++) {
executors.add(new ThreadPoolExecutor(POLL_SIZE, POLL_SIZE * 2, 10L, TimeUnit.SECONDS,
executors.add(new ThreadPoolExecutor(POLL_SIZE * 3, POLL_SIZE * 3, 10L, TimeUnit.SECONDS,
new LinkedBlockingQueue<>(), new PersistThreadFactory(i)));
}
log.info("数据持久化-线程池 name:{} coreSize:{} maxSize:{}", "PersistThreadPool", POLL_SIZE * POLL_SIZE, POLL_SIZE * POLL_SIZE * 2);
log.info("数据持久化-线程池 name:{} coreSize:{} maxSize:{}", "PersistThreadPool", POLL_SIZE * 3, POLL_SIZE * POLL_SIZE * 3);
}
public static PersistThreadPoolV2 getInstance() {
......
......@@ -108,6 +108,10 @@ public class TransactionServiceImpl implements TransactionService {
Set<String> conAddrSet = new HashSet<>();
if (transactionList.size() != 0) {
censusTransNumber = transactionList.size();
// 数据统计
this.censusFlushRedis(censusBlockSize, censusTransNumber);
transactionList.forEach(o -> {
// hex 数据转换成base58
String ownerAddress;
......@@ -149,11 +153,9 @@ public class TransactionServiceImpl implements TransactionService {
if (!CollectionUtils.isEmpty(records)) {
this.addressRepository.batchInsertOnDuplicateKey(records);
}
addressPushRedis(hexSet);
conAddrPushRedis(conAddrSet);
// 数据统计
this.censusFlushRedis(censusBlockSize, censusTransNumber);
}
}
......@@ -299,14 +301,8 @@ public class TransactionServiceImpl implements TransactionService {
* @param transNumber
*/
private void censusFlushRedis(String blockSize, Integer transNumber) {
String zero = "0";
if (!StringUtils.isEmpty(blockSize) && !blockSize.equals(zero)) {
this.stringRedisTemplate.opsForList().leftPush(Constant.CENSUS_BLOCK_SIZE, blockSize);
}
if (transNumber != 0) {
this.stringRedisTemplate.opsForList().leftPush(Constant.CENSUS_TRANS, transNumber.toString());
}
this.stringRedisTemplate.opsForList().leftPush(Constant.CENSUS_BLOCK_SIZE, blockSize);
this.stringRedisTemplate.opsForList().leftPush(Constant.CENSUS_TRANS, transNumber.toString());
}
@Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment