Commit 7f97f31
committed
perf(billing): skip the redundant cursor lookup when the caller already has it
The export loop holds the previous page's rows in memory, so its next
cursor's createdAt is already known — getUserUsageLogs was still
re-resolving it via an extra DB round trip every page regardless.
Added an optional cursorCreatedAt to skip that lookup when provided;
the list route's existing callers are unaffected since they don't
pass it. Verified live: zero cursor-lookup queries fired across a
3,500-row / 4-page export that previously issued one per page.1 parent d1dcf6c commit 7f97f31
3 files changed
Lines changed: 31 additions & 13 deletions
File tree
- apps/sim
- app/api/users/me/usage-logs/export
- lib/billing/core
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
176 | | - | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
177 | 180 | | |
178 | 181 | | |
179 | 182 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
| |||
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
| 56 | + | |
55 | 57 | | |
56 | 58 | | |
57 | 59 | | |
58 | 60 | | |
59 | 61 | | |
60 | 62 | | |
| 63 | + | |
| 64 | + | |
61 | 65 | | |
62 | 66 | | |
63 | 67 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
533 | 533 | | |
534 | 534 | | |
535 | 535 | | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
536 | 542 | | |
537 | 543 | | |
538 | 544 | | |
| |||
591 | 597 | | |
592 | 598 | | |
593 | 599 | | |
| 600 | + | |
594 | 601 | | |
595 | 602 | | |
596 | 603 | | |
| |||
614 | 621 | | |
615 | 622 | | |
616 | 623 | | |
617 | | - | |
618 | | - | |
619 | | - | |
620 | | - | |
621 | | - | |
622 | | - | |
623 | | - | |
624 | | - | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
625 | 637 | | |
626 | | - | |
627 | | - | |
| 638 | + | |
628 | 639 | | |
629 | | - | |
630 | | - | |
| 640 | + | |
| 641 | + | |
631 | 642 | | |
632 | 643 | | |
633 | 644 | | |
| |||
0 commit comments