INNER CODE UNIT · TypeScript

getRelayBackoffMs

dmotz/trystero · packages/nostr/src/index.ts:66

const getRelayBackoffMs = (client: SocketClient): number => {
  const state = relayBackoffs.get(client)

  if (!state) {
    return 0
  }

  const remainingMs = state.untilMs - Date.now()

  if (remainingMs > 0) {
    return remainingMs
  }

  return 0
}

const nextAnnounce = (nextAnnounceMs: number) => ({nextAnnounceMs})
const stopAnnouncing = {stopAnnouncing: true} as const

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…