1
This commit is contained in:
parent
a356500cb1
commit
818935d2cb
@ -215,3 +215,30 @@ CREATE TABLE `t_gameitemmall` (
|
||||
KEY `net_id_event_name_contract_address` (`net_id`, `event_name`, `contract_address`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `t_active_721nft`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `t_active_721nft`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `t_active_721nft` (
|
||||
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`txhash` varchar(255) NOT NULL DEFAULT '' COMMENT 'txhash',
|
||||
`log_index` bigint NOT NULL DEFAULT '0' COMMENT 'log_index',
|
||||
`hash_code` varchar(60) NOT NULL DEFAULT '' COMMENT 'hash_code',
|
||||
`net_id` bigint NOT NULL DEFAULT '0' COMMENT 'net_id',
|
||||
`event_name` varchar(60) NOT NULL DEFAULT '' COMMENT 'event_name',
|
||||
`contract_address` varchar(60) NOT NULL DEFAULT '' COMMENT 'contract_address',
|
||||
`contract_name` varchar(60) NOT NULL DEFAULT '' COMMENT 'contract_name',
|
||||
`block_number` bigint NOT NULL DEFAULT '0' COMMENT 'block_number',
|
||||
`return_values` mediumblob COMMENT 'return_values',
|
||||
`src_idx` bigint NOT NULL DEFAULT '0' COMMENT 'src_idx',
|
||||
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||
PRIMARY KEY (`idx`),
|
||||
UNIQUE KEY `unikey` (`txhash`, `hash_code`, `log_index`, `net_id`, `event_name`, `contract_address`),
|
||||
KEY `net_id_event_name_contract_address` (`net_id`, `event_name`, `contract_address`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
@ -10,28 +10,33 @@ class DbEventProcess extends BaseService {
|
||||
static #tableMaxIdxHash = {};
|
||||
|
||||
static async staticInit() {
|
||||
console.log(metaFactory.getAllTables());
|
||||
/*
|
||||
const {err, conn} = await app.getDbConn('BcEventDb0');
|
||||
{
|
||||
const {err, maxIdx} = await conn.getMaxIdx(BCEVENT_TABLE_NAME);
|
||||
if (err) {
|
||||
throw 'PullDbEvent error:' + err;
|
||||
}
|
||||
PullDbEvent.#maxIdx = maxIdx;
|
||||
}
|
||||
const updateMaxIdxFunc = async () => {
|
||||
while (true) {
|
||||
const {err, maxIdx} = await conn.getMaxIdx(BCEVENT_TABLE_NAME);
|
||||
if (!err) {
|
||||
PullDbEvent.#maxIdx = maxIdx;
|
||||
await utils.sleep(500 + utils.randRange(500, 1500));
|
||||
} else {
|
||||
await utils.sleep(5000 + utils.randRange(500, 1500));
|
||||
const tables = metaFactory.getAllTables();
|
||||
await utils.serial
|
||||
(
|
||||
Object.values(tables),
|
||||
async (tblObj) => {
|
||||
{
|
||||
const {err, maxIdx} = await conn.getMaxIdx(tblObj['table_name']);
|
||||
if (err) {
|
||||
throw 'DbEventProcess error:' + err;
|
||||
}
|
||||
DbEventProcess.#tableMaxIdxHash[tblObj['table_name']] = maxIdx;
|
||||
}
|
||||
const updateMaxIdxFunc = async () => {
|
||||
while (true) {
|
||||
const {err, maxIdx} = await conn.getMaxIdx(tblObj['table_name']);
|
||||
if (!err) {
|
||||
DbEventProcess.#tableMaxIdxHash[tblObj['table_name']] = maxIdx;
|
||||
await utils.sleep(500 + utils.randRange(500, 1500));
|
||||
} else {
|
||||
await utils.sleep(5000 + utils.randRange(500, 1500));
|
||||
}
|
||||
}
|
||||
};
|
||||
updateMaxIdxFunc();
|
||||
}
|
||||
};
|
||||
updateMaxIdxFunc();*/
|
||||
);
|
||||
}
|
||||
|
||||
async init(net, event) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user