Skip to content

Commit

Permalink
Feat/update coin transfer hasura and fix bug bulk insert coin transfer (
Browse files Browse the repository at this point in the history
#488)

* fix: fix bulk insert coin transfer

* feat: update coin transfer hasura
  • Loading branch information
matthew-nguyen-20032023 authored Nov 21, 2023
1 parent 956c968 commit f1fd125
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 3 deletions.
3 changes: 2 additions & 1 deletion ci/config.json.ci
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
"handleCoinTransfer": {
"key": "handleCoinTransfer",
"blocksPerCall": 100,
"millisecondCrawl": 3000
"millisecondCrawl": 3000,
"chunkSize": 1000
},
"handleTransaction": {
"key": "handleTransaction",
Expand Down
3 changes: 2 additions & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
"handleCoinTransfer": {
"key": "handleCoinTransfer",
"blocksPerCall": 100,
"millisecondCrawl": 3000
"millisecondCrawl": 3000,
"chunkSize": 1000
},
"handleTransaction": {
"key": "handleTransaction",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
table:
name: coin_transfer
schema: public
select_permissions:
- role: internal_service
permission:
columns:
- id
- block_height
- tx_id
- tx_msg_id
- from
- to
- amount
- denom
- timestamp
- created_at
filter: {}
limit: 100
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
table:
name: coin_transfer
schema: public
select_permissions:
- role: internal_service
permission:
columns:
- id
- block_height
- tx_id
- tx_msg_id
- from
- to
- amount
- denom
- timestamp
- created_at
filter: {}
limit: 100
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
table:
name: coin_transfer
schema: public
select_permissions:
- role: internal_service
permission:
columns:
- id
- block_height
- tx_id
- tx_msg_id
- from
- to
- amount
- denom
- timestamp
- created_at
filter: {}
limit: 100
19 changes: 19 additions & 0 deletions hasura/metadata/databases/xstaxy/tables/public_coin_transfer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
table:
name: coin_transfer
schema: public
select_permissions:
- role: internal_service
permission:
columns:
- id
- block_height
- tx_id
- tx_msg_id
- from
- to
- amount
- denom
- timestamp
- created_at
filter: {}
limit: 100
6 changes: 5 additions & 1 deletion src/services/crawl-tx/coin_transfer.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,11 @@ export default class CoinTransferService extends BullableService {

if (coinTransfers.length > 0) {
this.logger.info(`INSERTING ${coinTransfers.length} COIN TRANSFER`);
await CoinTransfer.query().transacting(trx).insert(coinTransfers);
await trx.batchInsert(
CoinTransfer.tableName,
coinTransfers,
config.handleCoinTransfer.chunkSize
);
}
});
}
Expand Down

0 comments on commit f1fd125

Please sign in to comment.