-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
handling "too few nodes responded" #103
Comments
Do you have a testcase to illustrate this? |
We use hyperswarm in our desktop application at startup. this.swarm = new Hyperswarm({
dht: new DHT({ ephemeral: true }),
jitter: JITTER,
keyPair: this.keyPair,
backoffs: [
BACKOFF_A + Math.round(JITTER * Math.random()),
BACKOFF_B + Math.round(JITTER * Math.random()),
BACKOFF_C + Math.round(JITTER * Math.random())
]
})
const discovery = this.discovery = await this.swarm.join(this.peerId, {
server: true,
client: false
})
await discovery.flushed()
this.swarm.flush() If the user is currently offline or in airplane mode or not connected to wifi or has spotty wifi then the hyperswarm module raises this too few nodes responded error. We would ideally want hyperswarm to be graceful and retry to see if an internet connection is available ( with backoff ). |
|
I think that's just code we were fiddling around with trying to figure out this error, not sure if |
flush can throw. You are meant to handle that. If you’re running it in the background, you need to noop the catch or node will crash. Down to make it return a bool instead of throwing if the pending ops fail if that’s easier for users. |
good to know! |
I am destroying the swarm somewhere that causes this https://github.com/hyperswarm/hyperswarm/blob/master/index.js#L352 |
+1 for making it bool. This could prevent a lot of people from being surprised or forgetting to handle it. |
When going offline i get the error Too few nodes responded from hyperswram (https://github.com/mafintosh/dht-rpc/blob/7527e8f83e7457750a0ece5469ed3b579c5799de/lib/query.js#L196). It seems like this could be caught by adding an error event up the stack, but im not sure what the intended idea was for handling this correctly. cc @mafintosh
There are two other issues this reference this without resolution.
The text was updated successfully, but these errors were encountered: