ipfs-webui icon indicating copy to clipboard operation
ipfs-webui copied to clipboard

Throttle IPFS_INIT_FAILED events

Open lidel opened this issue 4 years ago • 0 comments

Problem

When user opts-in to sending usage metrics, and ipfs-webui is not able to connect to HTTP API, it will send a new IPFS_INIT_FAILED event to Countly every few seconds when it tries to reconnect and fails again. This produces multiple events sent every minute:

2021-07-31--00-56-47

This behavior can be observed on https://webui.ipfs.io and inside of ipfs-desktop when a local node is shut down when webui is still open (need to opt-in to metrics first)

Additionally, on a slower machine ipfs-desktop shows ipfs-webui before go-ipfs is fully booted, but that triggers no more than one or two events.

Solution

We should be throttling how often IPFS_INIT_FAILED is sent.

Some quick ideas:

  • We want to decrease noise of situations where node started within a few seconds (either automatically in ipfs-desktop or manually when user forgot to run it)
    • Idea: do not send send it immediately, but keep buffering events and wait for IPFS_INIT_FAILED state to remain for 10+ seconds.
  • When IPFS_INIT_FAILED is confirmed by being real for over 10 seconds, we do not want to keep spamming events every few seconds.
    • Idea: send it only once every 5 minutes (memoize send function for 5min)

lidel avatar Jul 30 '21 23:07 lidel