MCPcopy Index your code
hub / github.com/simstudioai/sim / notifyTableRowUsage

Function notifyTableRowUsage

apps/sim/lib/table/billing.ts:69–88  ·  view source on GitHub ↗
(params: {
  workspaceId: string
  currentRowCount: number
  addedRows: number
  limit: number
})

Source from the content-addressed store, hash-verified

67 * concurrent crossings (no race).
68 */
69export 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

Callers 9

flushFunction · 0.90
billing.test.tsFile · 0.90
createTableFunction · 0.90
importAppendRowsFunction · 0.90
importReplaceRowsFunction · 0.90
insertRowFunction · 0.90
batchInsertRowsFunction · 0.90
replaceTableRowsFunction · 0.90
upsertRowFunction · 0.90

Calls 2

crossedUpFunction · 0.85
maybeNotifyTableRowLimitFunction · 0.85

Tested by

no test coverage detected