Skip to content
This repository has been archived by the owner on Sep 4, 2019. It is now read-only.

Add batch support #4

Closed
daffl opened this issue Jun 18, 2015 · 1 comment
Closed

Add batch support #4

daffl opened this issue Jun 18, 2015 · 1 comment

Comments

@daffl
Copy link
Member

daffl commented Jun 18, 2015

It should be pretty easy to add general support for feathers-batch to batch service calls. A small change that can add a big performance improvement to applications.

Batching can be done manually like:

var app = feathers('http://todos.feathersjs.com')
  .configure(feathers.jquery());

// Set all batching calls to execute in series
app.batch('type', 'series');

app.batch.start();

todoService.create({
  text: 'A todo',
  complete: false
}, function(error, todo) {
  console.log('Success');
});

todoService.find(function(error, todos) {
  console.log('Got the following Todos', todos);
});

app.batch.stop();

Or with a timeout that collects all simultaneous requests sent within a certain interval:

var app = feathers('http://todos.feathersjs.com')
  .configure(feathers.jquery());

app.batch({
  type: 'series',
  timeout: 100 // batch all request within 100ms
});

todoService.create({
  text: 'A todo',
  complete: false
}, function(error, todo) {
  console.log('Success');
});

todoService.find(function(error, todos) {
  console.log('Got the following Todos', todos);
});
@daffl
Copy link
Member Author

daffl commented Apr 16, 2016

I'm going to close this. It will be added when with the final version of the batch plugin when we add a performance and scaling chapter to the documentation.

@daffl daffl closed this as completed Apr 16, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant