MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / batch

Method batch

telemetry-worker/src/rollup.ts:514–529  ·  view source on GitHub ↗

One round trip: the statements run in order, in one implicit transaction.

(statements: D1PreparedStatement[])

Source from the content-addressed store, hash-verified

512
513 /** One round trip: the statements run in order, in one implicit transaction. */
514 async batch(statements: D1PreparedStatement[]): Promise<D1Result[]> {
515 for (let attempt = 0; ; attempt++) {
516 this.queries++;
517 try {
518 const results = await this.env.DB.batch(statements);
519 const spent = results.reduce((total, r) => total + (r.meta?.duration ?? 0), 0);
520 await pacing.sleep(Math.min(REST_MAX_MS, Math.max(REST_MIN_MS, REST_FACTOR * spent)));
521 return results;
522 } catch (err) {
523 const wait = RETRY_WAITS_MS[attempt];
524 if (wait === undefined || !RETRYABLE.test(String(err))) throw err;
525 this.retries++;
526 await pacing.sleep(wait);
527 }
528 }
529 }
530
531 /** The first row of one statement, or null. */
532 async first<T>(statement: D1PreparedStatement): Promise<T | null> {

Callers 15

firstMethod · 0.95
allMethod · 0.95
runScheduledFunction · 0.95
writeToD1Function · 0.45
rollupDayFunction · 0.45
foldLegacyUsageFunction · 0.45
perMachineRangeFunction · 0.45
purgeOldEventsFunction · 0.45
recordInstallProofFunction · 0.45
shortDaysFunction · 0.45
rollupWindowsFunction · 0.45
rollupCohortFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected