Class: Batcher

mw/Batcher~Batcher(env)

new Batcher(env)

This class combines requests into batches for dispatch to the ParsoidBatchAPI extension, and calls the item callbacks when the batch result is returned.

This class combines requests into batches for dispatch to the ParsoidBatchAPI extension, and calls the item callbacks when the batch result is returned. It handles scheduling and concurrency of batch requests. It also has a legacy mode which sends requests to the MW core API.

Parameters:
Name Type Description
env MWParserEnvironment
Source:

Members

(static) getPageProps

NOTE: We're making a direct call to the batching api here, rather than adding to an instantiated batcher, as defined above.

NOTE: We're making a direct call to the batching api here, rather than adding to an instantiated batcher, as defined above. We also don't have any support for getting this information via a legacy non-batcher API, although it could be done in principle; see https://github.com/wikimedia/mediawiki-extensions-ParsoidBatchAPI/commit/57fdabb2007437bef4e3f8b03e4593372d7d9974

Source:

imageinfo

Schedule fetching of image info.

Schedule fetching of image info.

Source:

legacyRequest

Helper for sending legacy requests when the extension is not available

.

Helper for sending legacy requests when the extension is not available

Source:

parse

Schedule an MW parse operation.

Schedule an MW parse operation.

Source:

preprocess

Schedule a proprocess (expandtemplates) operation.

Schedule a proprocess (expandtemplates) operation.

Source:

pushGeneric

Internal function for adding a generic work item.

Internal function for adding a generic work item.

Source:

Methods

dispatch()

Dispatch batches from the pending queue, if it is currently possible.

Dispatch batches from the pending queue, if it is currently possible.

Source:

forceDispatch()

Force immediate dispatch of a minimum unit of work, to avoid a stall.

Force immediate dispatch of a minimum unit of work, to avoid a stall. If a complete batch is pending, we will dispatch that, otherwise we will dispatch an incomplete batch.

Source:

makeForwardProgress()

If we don't have any outstanding requests, dispatch what we have right now to make sure that we make forward progress with the request.

If we don't have any outstanding requests, dispatch what we have right now to make sure that we make forward progress with the request.

Source:

onBatchResponse(batchParams, error, batchResult)

Handle a batch response and call item callbacks, after the request is decoded by BatchRequest.

Handle a batch response and call item callbacks, after the request is decoded by BatchRequest.

Parameters:
Name Type Description
batchParams Object

The parameters as in pushGeneric().

error Error | null
batchResult Array
Source:

request()

Actually send a single batch request with the specified parameters.

Actually send a single batch request with the specified parameters.

Source:

sealBatchAndDispatch()

Declare a batch complete and initiate dispatch.

Declare a batch complete and initiate dispatch.

Source:

trace()

Convenience helper for tracing.

Convenience helper for tracing.

Source: