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

rxdb-server parses lwt property to an integer - creating an infinite synchronization-loop #5883

Closed
David-van-der-Sluijs opened this issue Apr 9, 2024 · 1 comment

Comments

@David-van-der-Sluijs
Copy link

David-van-der-Sluijs commented Apr 9, 2024

In this line of the rxdb-server lwt gets parsed down to a integer which has the catastrophic side effect of creating an infinite synchronization-loop in the event when many documents have such a close lwt that they only differs in their decimal point so that they all get parsed to the exact same integer. This happens if we use bulkInsert or bulkUpsert:

await rxdb.yourCollection.bulkInsert( somethingBig );

A ugly workaround until a proper fix arrives is to just don't use bulk at all and rather something like this:

for ( const data of somethingBig ) {
    await new Promise( ( resolve ) => setTimeout( resolve, 1 ) ); // Ensuring `lwt` cannot be on the same ms
    await rxdb.yourCollection.insert( somethingBig );
}
@pubkey
Copy link
Owner

pubkey commented Apr 10, 2024

@David-van-der-Sluijs Thank you for the investigation. Indeed this is a bug. Can you make a PR with a fix and a test case?

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