Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Use a BatchManger explictly outside of hooks #110

Copy link
Copy link
@DaddyWarbucks

Description

@DaddyWarbucks
Issue body actions

This is a feature idea and not a bug

I know that I can use the excludes and timeout options to configure the batchClient to behave a certain way. But I have found some use cases where I think it would be nice to use some kind of static method to run some actions in a batch. For example,

// I only want to run these actions in Batch. For whatever reason I don't want them batched with
// other calls, or maybe I am not even using batchClient plugin at all.

const actions = [
  app.service('users').find(),
  app.service('items').find()
];

// Replace this
const results = await Promise.all(actions);

// with this
const results = await BatchManger.all(actions, managerConfig)

This could also be used server side. For example, the Promise.all(actions) does not allow the actions to share a dataloader from feathers-batchloader (unless you manually created one and passed to it, which is a perfectly viable option). Using BatchManger.all(actions, managerConfig) would go through the batch-service hooks and automatically share a dataloader (if setup, of course) and anything else that the batch-service may help out with.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.