Skip to content
This repository was archived by the owner on Apr 20, 2019. It is now read-only.
This repository was archived by the owner on Apr 20, 2019. It is now read-only.

[Request] Config flag to force requests to run sequentially #85

@WesTyler

Description

@WesTyler

We are currently using bassmaster, and it's working great for us. In some testing environments though it would be super helpful for dubugging if we could force the batch requests to run sequentially rather than concurrently.

I know that the code runs the reqs sequentially when there are refs from one to the next, or in certain cases with payloads, but that would require us to make some code changes on the endpoint in just this one env. If the plugin registration config could support something like the below, it would be super awesome

const bassmasterConfig = { batchEndpoint: '/batch' };
if (process.env.NODE_ENV === 'staging') {
    bassMasterConfig.forceSequential = true;
}

await server.register({
    plugin: Bassmaster,
    options: bassMasterConfig
})

Then in the source it could do something like

module.exports.config = function (settings) {

    if (settings.forceSequential) {
        internals.forceSequential = settings.forceSequential;
    }

    return { /* no changes here*/ }
};

and

if (internals.forceSequential || internals.hasRefPart(requestParts) || payloadParts.length) {
    return fnsSerial.push(
        async () => await internals.batch(request, resultsData, idx, requestParts, payloadParts)
    );
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions