ipfs-webui
ipfs-webui copied to clipboard
Throttle IPFS_INIT_FAILED events
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:
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_FAILEDstate to remain for 10+ seconds.
- Idea: do not send send it immediately, but keep buffering events and wait for
- When
IPFS_INIT_FAILEDis 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)
