You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 11, 2019. It is now read-only.
We need to have a list of valid peers and switch between them if the used one encounter issues.
I've tried a first solution for this problem :
# More for the idea than anything else. Currently it should work, but the# Erlang beam crashed, telling the following message :# eheap_alloc: Cannot allocate 915463784 bytes of memory (of type "heap").defget_best_dev_peersdopeers=get_dev("api/peers")peers["peers"]|>Enum.map(fn(x)->%{ip: x["ip"],delay: x["delay"]}end)|>Enum.sort|>Enum.slice(0,10)enddefget_random_viable_peerdoget_best_dev_peers()|>Enum.randomenddefget_ip_from_random_peerdoget_random_viable_peer()|>Enum.at(1)|>elem(1)end
But as commented, the implementation doesn't seems good. The idea is to fetch the best peers (ordered by delay) and to make our queries on the peer choosed (with his IP as our url).
Then it would be easy to make our queries, and then fallback on the best peer chosen if the first one failed.