Pull in more fedmsg-map changes.
... from https://github.com/fedora-infra/fedmsg/pull/338
This commit is contained in:
parent
2419f176e3
commit
055645e9d3
1 changed files with 26 additions and 23 deletions
|
@ -22,7 +22,7 @@ for_collectd = 'verbose' not in sys.argv
|
||||||
active = collections.defaultdict(list)
|
active = collections.defaultdict(list)
|
||||||
inactive = collections.defaultdict(list)
|
inactive = collections.defaultdict(list)
|
||||||
|
|
||||||
pool = multiprocessing.pool.ThreadPool(10)
|
pool = multiprocessing.pool.ThreadPool(25)
|
||||||
|
|
||||||
def info(content="\n"):
|
def info(content="\n"):
|
||||||
if not for_collectd:
|
if not for_collectd:
|
||||||
|
@ -30,8 +30,7 @@ def info(content="\n"):
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
|
|
||||||
def scan_one(item):
|
def scan_one(item):
|
||||||
name, endpoints = item
|
name, endpoint = item
|
||||||
for endpoint in endpoints:
|
|
||||||
if not endpoint.startswith('tcp://'):
|
if not endpoint.startswith('tcp://'):
|
||||||
raise ValueError("Don't know how to deal with %r" % endpoint)
|
raise ValueError("Don't know how to deal with %r" % endpoint)
|
||||||
endpoint = endpoint[len('tcp://'):].split(':')
|
endpoint = endpoint[len('tcp://'):].split(':')
|
||||||
|
@ -54,8 +53,10 @@ def scan_one(item):
|
||||||
|
|
||||||
|
|
||||||
def scan_all():
|
def scan_all():
|
||||||
|
items = [(name, addr)
|
||||||
pool.map(scan_one, config['endpoints'].items())
|
for name, endpoints in config['endpoints'].items()
|
||||||
|
for addr in endpoints]
|
||||||
|
pool.map(scan_one, items)
|
||||||
|
|
||||||
info()
|
info()
|
||||||
|
|
||||||
|
@ -128,3 +129,5 @@ else:
|
||||||
print(output)
|
print(output)
|
||||||
if interval - delta > 0:
|
if interval - delta > 0:
|
||||||
time.sleep(interval - delta)
|
time.sleep(interval - delta)
|
||||||
|
|
||||||
|
pool.close()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue