bitcoinjs / indexd

An external bitcoind index management service module
ISC License
53 stars 23 forks source link

If ZMQ messages stop, resync never retries #25

Closed dcousens closed 6 years ago

dcousens commented 6 years ago

We rely on ZMQ at the moment to trigger a resync, but, we could additionally encourage a poll w/ a time interval.

Otherwise, if the ZMQ socket goes down, the indexd node will cease to synchronize at all.

Easily extended... either way, its at the example/ level, not part of the module itself, but I think everyone uses example as the reference implementation at the moment as it is non-trivial.

deweller commented 6 years ago

Will ZMQ automatically reconnect on the same socket if the socket goes away for a while and then becomes available again?

So imagine bitcoind goes away for a minute for a restart. When bitcoind comes back up, will the ZMQ socket automatically reconnect and see messages?

If not, should we listen for a "disconnected" event emitted from the ZMQ library and periodically try and reconnect?

dcousens commented 6 years ago

@deweller yes it would.

That said, if you are using ~/.bitcoin/.cookie for the RPC AUTH (like I do in example/), then you need to restart indexd for that anyhow.

If not, should we listen for a "disconnected" event emitted from the ZMQ library and periodically try and reconnect?

I don't know if this could happen, but if it did, then yes. My understanding was it tries to stay connected.

KanoczTomas commented 6 years ago

the new bitcoind has an uptime rpc call, perhaps after issues it could be checked to see if bitcoind went away and we need to reconnect ...

dcousens commented 6 years ago

Polling every 1-60 seconds is probably not an issue, and would be as adequate as any differencing solution.

dcousens commented 6 years ago

60s backup polling added in a4d5715 for the example