Skip to content
Snippets Groups Projects
Commit 113ff0e0 authored by Bo-Chun Chen's avatar Bo-Chun Chen
Browse files

Update default callback in rc_util

It acted like task manager when first design it.
Now we have proper task manager, update it.
The default behavior will be a caller waiting to complete msg
parent be439a15
No related branches found
No related tags found
4 merge requests!147Merge previous default branch feat-cod-rmq into main,!85kill nginx process running under user from login node,!78Feat cod rmq,!66Update rcutil
...@@ -21,19 +21,18 @@ def add_account(username, email, full='', reason=''): ...@@ -21,19 +21,18 @@ 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 == '':
......
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