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

testing celery message passign

parent 49903e41
No related merge requests found
......@@ -105,7 +105,7 @@
<input class="form-control" id="fullname" name="fullname" placeholder="Enter Full Name" required="" type="text">
<label><b><label for="reason">Reason for Requesting Account: </label><br></b></label>
<textarea class="form-control" id="reason" name="reason" placeholder="Enter Reason for Account Request" required=""></textarea>
<input class="btn btn-primary btn-block" id="submit" name="submit" type="button" value="Submit" onclick="request_account()">
<input class="btn btn-primary btn-block" id="submit" name="submit" type="button" value="Submit" onclick="displayloading();request_account()">
<div>
<strong id="error" style="color: #be051b; text-align: center;"></strong>
......
......@@ -31,7 +31,7 @@ def user_connected(json, methods=['GET', 'POST']):
@socketio.on('request account')
def request_account(json, methods=['GET', 'POST']):
socketio.emit("creating account")
print (time.strftime("%m-%d-%Y_%H:%M:%S") + '\tQueue request received: ' + str(json))
room = str(session['uid'])
......@@ -39,6 +39,7 @@ def request_account(json, methods=['GET', 'POST']):
try:
socketio.emit("creating account")
#create_account(json['username'], json['fullname'], json['reason'])
tasks.celery_create_account(json['username'], json['fullname'], json['reason'], room, socketio)
......
......@@ -11,9 +11,9 @@ celery = Celery('flask_user_reg', broker='amqp://')
@celery.task
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)
time.sleep(10)
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