Skip to content

Commit

Permalink
enhancement: using namebids to test handling of tables with large num…
Browse files Browse the repository at this point in the history
…ber of rows
  • Loading branch information
dafuga committed Jun 21, 2023
1 parent 5c7e545 commit 4aac6a7
Show file tree
Hide file tree
Showing 39 changed files with 380,879 additions and 21,335 deletions.
7 changes: 6 additions & 1 deletion src/contract/table-cursor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,17 @@ export class TableCursor<TableRow> {
if (this.indexPositionField) {
const fieldToIndexMapping = await this.table.getFieldToIndex()

if (!fieldToIndexMapping[this.indexPositionField]) {
console.log({fieldToIndexMapping, indexPositionField: this.indexPositionField})
throw new Error(`Field ${this.indexPositionField} is not a valid index.`)
}

indexPosition = fieldToIndexMapping[this.indexPositionField].index_position
}

const {rows, next_key} = await this.table.contract.client!.v1.chain.get_table_rows({
...this.tableParams,
limit: Math.min(this.tableParams.limit - this.rowsCount, 10000),
limit: Math.min(this.tableParams.limit - this.rowsCount, 1000000),
lower_bound: lower_bound ? lower_bound : undefined,
upper_bound: upper_bound ? upper_bound : undefined,
index_position: indexPosition,
Expand Down
2 changes: 1 addition & 1 deletion src/contract/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ export class Table<TableRow extends ABISerializableConstructor = ABISerializable
table: this.name,
code: this.contract.account,
type: this.rowType,
limit: 10000,
limit: 1000000,
}

return new TableCursor({
Expand Down
Loading

0 comments on commit 4aac6a7

Please sign in to comment.