Skip to content

Commit

Permalink
Use constant for max transaction history lenght
Browse files Browse the repository at this point in the history
  • Loading branch information
Gudahtt committed Aug 1, 2024
1 parent c4b1743 commit 93598f3
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions app/scripts/migrations/120.3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ type VersionedData = {

export const version = 120.3;

const MAX_TRANSACTION_HISTORY_LENGTH = 100;

/**
* This migration trims the size of any large transaction histories. This will
* result in some loss of information, but the impact is minor. The lost data
Expand Down Expand Up @@ -82,8 +84,14 @@ function transformState(state: Record<string, unknown>): void {
}

for (const transaction of validHistoryTransactions) {
if (transaction.history && transaction.history.length > 100) {
transaction.history = transaction.history.slice(0, 100);
if (
transaction.history &&
transaction.history.length > MAX_TRANSACTION_HISTORY_LENGTH
) {
transaction.history = transaction.history.slice(
0,
MAX_TRANSACTION_HISTORY_LENGTH,
);
}
}
}
Expand Down

0 comments on commit 93598f3

Please sign in to comment.