Skip to content
Snippets Groups Projects
Commit ff4505b0 authored by Krish Moodbidri's avatar Krish Moodbidri
Browse files

added callback function with error print to command line

parent c95fc667
No related branches found
No related tags found
1 merge request!8made UI changes to the app
......@@ -4,6 +4,7 @@ from flask_socketio import SocketIO
import subprocess
import vars
import sys
import json
sys.path.append('/cm/shared/rabbitmq_agents/')
import rc_util
......@@ -16,7 +17,18 @@ celery = Celery('flask_user_reg', broker=broker_url)
socketio = SocketIO(message_queue=vars.message_queue)
def callback():
def callback(channel, method, properties, body):
msg = json.loads(body)
username = msg['username']
if msg['success']:
print(f'Account for {username} has been created.')
else:
print(f"There's some issue while creating account for {username}")
errmsg = msg.get('errmsg', [])
for err in errmsg:
print(err)
rc_util.rc_rmq.stop_consume()
rc_util.rc_rmq.delete_queue()
......@@ -39,4 +51,5 @@ def celery_create_account(json, session):
rc_util.add_account(username, email, fullname, reason)
print('sent account info')
print('Waiting for completion...')
rc_util.consume(username, routing_key=f'complete.{username}', callback=callback)
rc_util.consume(username, routing_key=f'complete.{username}', callback=callback)
send_msg('account ready', room)
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