MCPcopy
hub / github.com/prisma/prisma / request

Method request

packages/client/src/runtime/DataLoader.ts:23–48  ·  view source on GitHub ↗
(request: T)

Source from the content-addressed store, hash-verified

21 }
22
23 request(request: T): Promise<any> {
24 const hash = this.options.batchBy(request)
25 if (!hash) {
26 return this.options.singleLoader(request)
27 }
28 if (!this.batches[hash]) {
29 this.batches[hash] = []
30
31 // make sure, that we only tick once at a time
32 if (!this.tickActive) {
33 this.tickActive = true
34 process.nextTick(() => {
35 this.dispatchBatches()
36 this.tickActive = false
37 })
38 }
39 }
40
41 return new Promise((resolve, reject) => {
42 this.batches[hash].push({
43 request,
44 resolve,
45 reject,
46 })
47 })
48 }
49
50 private dispatchBatches() {
51 for (const key in this.batches) {

Callers

nothing calls this directly

Calls 2

dispatchBatchesMethod · 0.95
pushMethod · 0.45

Tested by

no test coverage detected