Skip to content

Commit

Permalink
[CT-808] Add subaccount limit per pnl run (#1527)
Browse files Browse the repository at this point in the history
* add subaccount limit
  • Loading branch information
dydxwill authored May 16, 2024
1 parent 1aa9e26 commit 430c208
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions indexer/services/roundtable/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ export const configSchema = {
// PNL ticks
PNL_TICK_UPDATE_INTERVAL_MS: parseInteger({ default: ONE_HOUR_IN_MILLISECONDS }),
PNL_TICK_MAX_ROWS_PER_UPSERT: parseInteger({ default: 1000 }),
PNL_TICK_MAX_ACCOUNTS_PER_RUN: parseInteger({ default: 65000 }),

// Remove expired orders
BLOCKS_TO_DELAY_EXPIRY_BEFORE_SENDING_REMOVES: parseInteger({ default: 20 }),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export async function getPnlTicksCreateObjects(
const accountsToUpdate: string[] = [
...getAccountsToUpdate(accountToLastUpdatedBlockTime, blockTime),
...newSubaccountIds,
];
].slice(0, config.PNL_TICK_MAX_ACCOUNTS_PER_RUN);
stats.gauge(
`${config.SERVICE_NAME}_get_ticks_accounts_to_update`,
accountsToUpdate.length,
Expand Down
3 changes: 3 additions & 0 deletions indexer/services/roundtable/src/tasks/create-pnl-ticks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ export default async function runTask(): Promise<void> {
at: 'create-pnl-ticks#runTask',
message: 'Error when getting pnl ticks',
error,
latestBlockHeight,
latestBlockTime,
txId,
});
return;
} finally {
Expand Down

0 comments on commit 430c208

Please sign in to comment.