Skip to content
Snippets Groups Projects
Commit ee9f5bb1 authored by Mitchell Moore's avatar Mitchell Moore
Browse files

Finish minor celery implementation

parent 3adc9f39
No related branches found
No related tags found
No related merge requests found
......@@ -57,7 +57,7 @@ def request_account(json, methods=['GET', 'POST']):
try:
# create_account(json['username'], json['fullname'], json['reason'])
tasks.celery_create_account(json['username'], json['fullname'], json['reason'], room_global)
tasks.celery_create_account(json['username'], json['fullname'], json['reason'], room_global, socketio)
except Exception as e:
print(time.strftime("%m-%d-%Y_%H:%M:%S") + "\tError in account creation: ", e)
......
......@@ -6,14 +6,15 @@ monkey.patch_all(subprocess=True)
celery = Celery('flask_user_reg', broker='amqp://')
socketio = SocketIO(message_queue='amqp:///socketio')
# socketio = SocketIO(message_queue='amqp:///socketio')
@celery.task
def celery_create_account(username, fullname, reason, room):
def celery_create_account(username, fullname, reason, room, socketio):
# Todo: Ravi's and Louis's code goes here
print(time.strftime("%m-%d-%Y_%H:%M:%S") + '\tUser ' + username + ' added to queue')
socketio.emit("creating account", room=room)
time.sleep(5)
print(time.strftime("%m-%d-%Y_%H:%M:%S") + '\tAccount successfully created for ' + username)
socketio.emit('account ready', room=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