Closed dcousens closed 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?
@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.
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 ...
Polling every 1-60 seconds is probably not an issue, and would be as adequate as any differencing solution.
60s backup polling added in a4d5715 for the example
We rely on
ZMQ
at the moment to trigger aresync
, but, we could additionally encourage apoll
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 usesexample
as the reference implementation at the moment as it is non-trivial.