blockcore-notes icon indicating copy to clipboard operation
blockcore-notes copied to clipboard

Optimization of database writes

Open sondreb opened this issue 2 years ago • 1 comments

When Notes receive a lot of the same events, there is a race-condition on get and puts resulting in multiple puts happening because the async await is waiting while next event triggers.

This could be optimized potentially with an queue for writes, where events fill up a queue instead of writing directly as now. The queue could also potentially look for duplicates directly when inserting into the update queues.

Example code where put of contacts and profile happens multiple times, depending on number of relays:

image

sondreb avatar Feb 12 '23 21:02 sondreb

image

sondreb avatar Feb 13 '23 21:02 sondreb