(params: {
workspaceId: string
currentRowCount: number
addedRows: number
limit: number
})
| 67 | * concurrent crossings (no race). |
| 68 | */ |
| 69 | export function notifyTableRowUsage(params: { |
| 70 | workspaceId: string |
| 71 | currentRowCount: number |
| 72 | addedRows: number |
| 73 | limit: number |
| 74 | }): void { |
| 75 | if (params.limit <= 0) return |
| 76 | const prePct = (params.currentRowCount / params.limit) * 100 |
| 77 | const postPct = ((params.currentRowCount + params.addedRows) / params.limit) * 100 |
| 78 | if ( |
| 79 | crossedUp(prePct, postPct, TABLE_WARN_PERCENT) || |
| 80 | crossedUp(prePct, postPct, TABLE_REACHED_PERCENT) |
| 81 | ) { |
| 82 | void maybeNotifyTableRowLimit( |
| 83 | params.workspaceId, |
| 84 | params.currentRowCount + params.addedRows, |
| 85 | params.limit |
| 86 | ) |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | /** |
| 91 | * Plan lookups hit billing + subscription tables (2-3 queries). Row-limit checks |
no test coverage detected