MCPcopy Create free account
hub / github.com/graphql-python/graphene / dispatch_queue

Function dispatch_queue

graphene/utils/dataloader.py:195–213  ·  view source on GitHub ↗

Given the current state of a Loader instance, perform a batch load from its current queue.

(loader)

Source from the content-addressed store, hash-verified

193
194
195def dispatch_queue(loader):
196 """
197 Given the current state of a Loader instance, perform a batch load
198 from its current queue.
199 """
200 # Take the current loader queue, replacing it with an empty queue.
201 queue = loader._queue
202 loader._queue = []
203
204 # If a max_batch_size was provided and the queue is longer, then segment the
205 # queue into multiple batches, otherwise treat the queue as a single batch.
206 max_batch_size = loader.max_batch_size
207
208 if max_batch_size and max_batch_size < len(queue):
209 chunks = get_chunks(queue, max_batch_size)
210 for chunk in chunks:
211 ensure_future(dispatch_queue_batch(loader, chunk))
212 else:
213 ensure_future(dispatch_queue_batch(loader, queue))
214
215
216async def dispatch_queue_batch(loader, queue):

Callers 2

do_resolve_rejectMethod · 0.85
dispatchFunction · 0.85

Calls 2

get_chunksFunction · 0.85
dispatch_queue_batchFunction · 0.85

Tested by

no test coverage detected