Skip to content

changesReader doesn't batch #298

Open
@andywillis

Description

@andywillis

Expected Behavior

I would expect the following code to wait 10 seconds and then return a batch of messages from the last position in the changes feed. So if I updated the DB 5 times within that 10 second timeout I would expect to see: "a batch of 5 changes has arrived" after 10 seconds.

messages.changesReader
  .start({ timeout: 10000 })
  .on('batch', (batch) => {
    console.log('a batch of', batch.length, 'changes has arrived');
  }).on('error', (e) => {
    console.error('error', e);
  });

Current Behavior

What is happening is that no batching is taking place. Every time I update the database within that timeout I immediately get the log "a batch of 1 changes has arrived".

Have I missed something obvious or misunderstood how nano's batching works?

Your Environment

  • Node v16.5
  • npm 8.5.5
  • Windows 10

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