Expand ECA secondary allocation algorithm
This commit is contained in:
parent
c4db8ec99d
commit
bb3b96e7f7
|
@ -69,8 +69,15 @@ def emptyChanAllocate(net, flist, relay, new):
|
||||||
chanfree[0][i] = chanfree[1]
|
chanfree[0][i] = chanfree[1]
|
||||||
allocated = {}
|
allocated = {}
|
||||||
toalloc = len(flist)
|
toalloc = len(flist)
|
||||||
|
# toalloc:2148 free:{1: 250} chanlimit:250 correction:2147
|
||||||
if toalloc > sum(chanfree[0].values()):
|
if toalloc > sum(chanfree[0].values()):
|
||||||
correction = round(toalloc - sum(chanfree[0].values()) / chanfree[1])
|
sum_free = sum(chanfree[0].values()) # 250
|
||||||
|
chans_not_covered = toalloc - sum_free # 2148 - 250 = 1898
|
||||||
|
relays_needed = chans_not_covered / chanfree[1] # 1898 / 250 = 7.592
|
||||||
|
relays_needed_rounded = round(relays_needed)
|
||||||
|
debug(f"emptyChanAllocate() secondary allocation sum_free:{sum_free} chans_not_covered:{chans_not_covered} relays_needed:{relays_needed} relays_needed_rounded:{relays_needed_rounded}")
|
||||||
|
#correction = round(toalloc - sum(chanfree[0].values()) / chanfree[1])
|
||||||
|
correction = relays_needed_rounded
|
||||||
debug(f"emptyChanAllocate() not enough free channels: toalloc:{toalloc} free:{chanfree[0]} chanlimit:{chanfree[1]} correction:{correction}")
|
debug(f"emptyChanAllocate() not enough free channels: toalloc:{toalloc} free:{chanfree[0]} chanlimit:{chanfree[1]} correction:{correction}")
|
||||||
warn("Ran out of channel spaces, provisioning additional %i relays for %s" % (correction, net))
|
warn("Ran out of channel spaces, provisioning additional %i relays for %s" % (correction, net))
|
||||||
modules.provision.provisionMultipleRelays(net, correction)
|
modules.provision.provisionMultipleRelays(net, correction)
|
||||||
|
|
Loading…
Reference in New Issue