block-core/blockcore-notes

Optimization of database writes

sondreb opened this issue · 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