One day's statements, each over a sixteenth of the machines, a few to a round trip.
(
lane: Lane,
env: Env,
day: string,
statements: ReadonlyArray<{ sql: string; extra?: readonly string[] }>,
)
| 769 | |
| 770 | /** One day's statements, each over a sixteenth of the machines, a few to a round trip. */ |
| 771 | async function perMachineRange( |
| 772 | lane: Lane, |
| 773 | env: Env, |
| 774 | day: string, |
| 775 | statements: ReadonlyArray<{ sql: string; extra?: readonly string[] }>, |
| 776 | ): Promise<void> { |
| 777 | const bound = machineIdRanges(1).flatMap(([from, before]) => |
| 778 | statements.map(({ sql, extra = [] }) => env.DB.prepare(sql).bind(day, from, before, ...extra)), |
| 779 | ); |
| 780 | for (const group of chunked(bound, KEEP_BATCH)) await lane.batch(group); |
| 781 | } |
| 782 | |
| 783 | /** |
| 784 | * Record, from one day's raw rows, the two things about a machine that are kept |