mafintosh / hyperdb

Distributed scalable database
MIT License
753 stars 75 forks source link

Fix race condition with history stream on auth'd feed #49

Closed hackergrrl closed 6 years ago

hackergrrl commented 6 years ago

This addresses the following situation:

  1. A hyperdb is created (A); it authorizes a new feed (B)
  2. A live history stream is created on B (no entries written yet) and B writes its first entry
  3. The writer event will fire first
  4. The writer event handler in createHistoryStream turns off event listeners and does an async call to lookup the new head node
  5. During this async period append fires, but is lost because step 4 turned it off
  6. The history stream hangs indefinitely, waiting for an append event that never comes
hackergrrl commented 6 years ago

v2.1.0