diff --git a/package.json b/package.json index 04ac75f..a4cf875 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nostr-tools", - "version": "0.8.0", + "version": "0.8.1", "description": "Tools for making a Nostr client.", "repository": { "type": "git", diff --git a/relay.js b/relay.js index cc35cc2..d7064db 100644 --- a/relay.js +++ b/relay.js @@ -46,7 +46,10 @@ export function relayConnect(url, onNotice) { ws.onclose = () => { resetOpenState() attemptNumber++ - nextAttemptSeconds += attemptNumber + nextAttemptSeconds += attemptNumber ** 3 + if (nextAttemptSeconds > 14400) { + nextAttemptSeconds = 14400 // 4 hours + } console.log( `relay ${url} connection closed. reconnecting in ${nextAttemptSeconds} seconds.` )