hypercore: hypercore doesn't fire `.ready(cb)` when `random-access-memory`

in our project

  1. when we run npm start and no files have been created yet:
    1. it needs one start which doesn’t work, but creates the first hypercore files
    2. it needs a restart which doesn’t work, but creates the second hypercore files
    3. from then on - every additional restart makes it work finally
  2. if we start using random-access-memory for creating hypercores here and here it stops working altogether and it is not calling the .ready(cb) callback here and here anymore no matter how often we restart.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 20 (12 by maintainers)

Most upvoted comments

Because I create a new hypercore and then in the same process also join the swarm and seed data to another peer and all this is running in the same process. Without flush() it created a hypercore but when I appended some data and then logged .length it was 0. After I ran flush, I get the length and all the other processes run ok after that.

On Mon, Feb 10, 2020 at 11:00 PM Mathias Buus notifications@github.com wrote:

Why do you need to call flush?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mafintosh/hypercore/issues/242?email_source=notifications&email_token=AAIGZS3LYVPROCSAVEX6YO3RCJEIXA5CNFSM4KIPHYS2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELLMN5Q#issuecomment-584500982, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAIGZS5VUM4XEIVWBGJG2UTRCJEIXANCNFSM4KIPHYSQ .

– Kind regards,

Nina Breznik, Vision Baker playproject.io wizardamigos.com

twitter.com/ninabreznik

Telegram: +1 510 747 84 39 gitter.im/ninabreznik

Just fixed this problem I had with using ram for my hypercore.

Ha! The problem was I created a hypercore AND immediately started working with it. So after hours of banging my head against the wall I went back to the beginning and read the whole hypercore docs and removed all the code and checked out your example.js when I discovered a magic word flush I think it would be super great to add flush to the docs