Skip to content
Snippets Groups Projects
Unverified Commit b3283389 authored by Ravi Tripathi's avatar Ravi Tripathi Committed by GitHub
Browse files

Merge pull request #66 from diedpigs/update-util

Update rcutil
parents 64d1d953 0172a886
No related branches found
No related tags found
3 merge requests!147Merge previous default branch feat-cod-rmq into main,!85kill nginx process running under user from login node,!78Feat cod rmq
...@@ -21,23 +21,22 @@ def add_account(username, email, full='', reason=''): ...@@ -21,23 +21,22 @@ def add_account(username, email, full='', reason=''):
def worker(ch, method, properties, body): def worker(ch, method, properties, body):
msg = json.loads(body) msg = json.loads(body)
task = msg['task'] username = msg['username']
tasks[task] = msg['success']
print("Got msg: {}({})".format(msg['task'], msg['success']))
# Check if all tasks are done if msg['success']:
done = True print(f'Account for {username} has been created.')
for key, status in tasks.items(): else:
if not status: print(f"There's some issue while creating account for {username}")
print("{} is not done yet.".format(key)) errmsg = msg.get('errmsg', [])
done = False for err in errmsg:
if done: print(err)
rc_rmq.stop_consume()
rc_rmq.delete_queue() rc_rmq.stop_consume()
rc_rmq.delete_queue()
def consume(username, routing_key='', callback=worker, debug=False): def consume(username, routing_key='', callback=worker, debug=False):
if routing_key == '': if routing_key == '':
routing_key = 'confirm.' + username routing_key = 'complete.' + username
if debug: if debug:
sleep(5) sleep(5)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment