libp2p / observer-toolkit

🐣 [WIP] toolkit for building libp2p introspection widgets + a few useful out-of-the-box widgets
https://libp2p.io
MIT License
2 stars 2 forks source link

Work around missing closed connections by inferring from old states #69

Closed AlanSl closed 4 years ago

AlanSl commented 4 years ago

We expect closed connections to appear in state messages until a cutoff time is reached, but the REPL doesn't work like that and apparently won't, so this works around the missing data by looking back through old states.

This workaround is compatible with data sources that do provide closed connections in the state messages (so, no need to regenerate mock / sample data). Performance appears to be fine: even on long REPL runs with large numbers of states and missing closed connections, the operation takes less than 1ms on my machine.

Transport data is also missing completely in the REPL so I'm just removing that column for now (commented out so it's easy to add back in).