Implement indexing into Apache Druid #1
|
@ -5,7 +5,7 @@ from twisted.internet.threads import deferToThread
|
|||
|
||||
import main
|
||||
import modules.provision
|
||||
from utils.logging.debug import debug
|
||||
from utils.logging.debug import debug, trace
|
||||
from utils.logging.log import error, log, warn
|
||||
|
||||
|
||||
|
@ -77,22 +77,31 @@ def emptyChanAllocate(net, flist, relay, new):
|
|||
chans_not_covered = toalloc - sum_free # 2148 - 250 = 1898
|
||||
relays_needed = chans_not_covered / chanfree[1] # 1898 / 250 = 7.592
|
||||
correction = ceil(relays_needed)
|
||||
debug(
|
||||
(
|
||||
f"emptyChanAllocate() secondary allocation sum_free:{sum_free} "
|
||||
f"chans_not_covered:{chans_not_covered} relays_needed:{relays_needed} "
|
||||
f"correction:{correction}"
|
||||
if main.config["ChanKeep"]["Provision"]:
|
||||
debug(
|
||||
(
|
||||
f"emptyChanAllocate() secondary allocation sum_free:{sum_free} "
|
||||
f"chans_not_covered:{chans_not_covered} relays_needed:{relays_needed} "
|
||||
f"correction:{correction}"
|
||||
)
|
||||
)
|
||||
)
|
||||
debug(
|
||||
(
|
||||
f"emptyChanAllocate() not enough free channels: toalloc:{toalloc} "
|
||||
f"free:{chanfree[0]} chanlimit:{chanfree[1]} correction:{correction}"
|
||||
debug(
|
||||
(
|
||||
f"emptyChanAllocate() not enough free channels: toalloc:{toalloc} "
|
||||
f"free:{chanfree[0]} chanlimit:{chanfree[1]} correction:{correction}"
|
||||
)
|
||||
)
|
||||
)
|
||||
warn("Ran out of channel spaces, provisioning additional %i relays for %s" % (correction, net))
|
||||
modules.provision.provisionMultipleRelays(net, correction)
|
||||
return False
|
||||
warn("Ran out of channel spaces, provisioning additional %i relays for %s" % (correction, net))
|
||||
modules.provision.provisionMultipleRelays(net, correction)
|
||||
return False
|
||||
else:
|
||||
# We don't have enough spaces and we can't add any.
|
||||
# Let's do the best we can in the circumstances.
|
||||
debug(f"emptyChanAllocate() cannot create additional relays for {net}")
|
||||
debug(f"emptyChanAllocate() {chans_not_covered} channels cannot be covered")
|
||||
flist = flist[:sum_free]
|
||||
debug(f"emptyChanAllocate() flist truncated to {sum_free}, length nis now {len(flist)}")
|
||||
trace(f"emptyChanAllocate() best effort allocation: {flist}")
|
||||
for i in chanfree[0].keys():
|
||||
for x in range(chanfree[0][i]):
|
||||
if not len(flist):
|
||||
|
|
Loading…
Reference in New Issue