Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Batch with size > 1 is inconsistent #32

Open
eldoy opened this issue Jun 12, 2024 · 1 comment
Open

Batch with size > 1 is inconsistent #32

eldoy opened this issue Jun 12, 2024 · 1 comment

Comments

@eldoy
Copy link
Owner

eldoy commented Jun 12, 2024

This works:

await db('update').batch({}, { size: 1 }, async function (enhet) {

but this is buggy:

await db('update').batch({}, { size: 2 }, async function (enhet) {

What is going on?

@acmb
Copy link
Collaborator

acmb commented Jun 13, 2024

Hei, @eldoy!

I replicated batch.test.js:'should batch find documents with size option' but the tests still pass.
I even added a promise inside our callback to see if anything would go wrong, but it didn't seem to happen.

it.only('should batch find documents with size option 1', async () => {
  let list = []
  await db('project').batch({}, { size: 1 }, async function (project) {
    await wait()
    list = list.concat(project)
  })
  expect(list.length).toBe(docs.length)
  for (let i = 0; i < n; i++) {
    expect(docs[i].name).toEqual(list[i].name)
  }
  expect(list.length).toEqual(docs.length)
})

it.only('should batch find documents with size option 2', async () => {
  let list = []
  await db('project').batch({}, { size: 2 }, async function (project) {
    await wait()
    list = list.concat(project)
  })
  expect(list.length).toBe(docs.length)
  for (let i = 0; i < n; i++) {
    expect(docs[i].name).toEqual(list[i].name)
  }
  expect(list.length).toEqual(docs.length)
})

Is there any extra information you can share to reproduce the issue?
What type of inconsistency are we experiencing?
Maybe the callback function could provide some clues.
Maybe an export from the update collection could also help reproduce the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants