RTradeLtd / Nexus

🦑 Nexus is the IPFS private network node orchestration and registry service for Temporal
https://dev.temporal.cloud/private
Apache License 2.0
14 stars 4 forks source link

TEM-62 network: add cache to optimize and prevent port claim conflicts #7

Closed bobheadxi closed 5 years ago

bobheadxi commented 5 years ago

:construction_worker: Purpose

If a port is "claimed" but another request comes along before the first node starts, both nodes might be assigned the same port, which is bad

also, with the existing implementation which will go through the entire range of ports, the cache can grow to a nasty size very quickly, so i introduced a small optimization to port assignment

:rocket: Changes

adds a cache set to expire port claims after 5 minutes make port assignment random to reduce cache growth

:warning: Breaking Changes

none

codecov[bot] commented 5 years ago

Codecov Report

:exclamation: No coverage uploaded for pull request base (master@7e771a8). Click here to learn what that means. The diff coverage is 93.16%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master       #7   +/-   ##
=========================================
  Coverage          ?   83.41%           
=========================================
  Files             ?       15           
  Lines             ?      693           
  Branches          ?        0           
=========================================
  Hits              ?      578           
  Misses            ?       75           
  Partials          ?       40
Impacted Files Coverage Δ
registry/registry.go 100% <100%> (ø)
network/cache.go 100% <100%> (ø)
orchestrator/orchestrator.go 88.89% <100%> (ø)
network/util.go 60% <60%> (ø)
network/ports.go 86.21% <84.22%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 7e771a8...4606a4d. Read the comment docs.