From 58653950d0fe51cde342076a4a07409d89271d07 Mon Sep 17 00:00:00 2001
From: Krish Moodbidri <krish94@uab.edu>
Date: Tue, 9 Mar 2021 16:30:06 -0600
Subject: [PATCH] WIP:added callback function

---
 tasks.py | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/tasks.py b/tasks.py
index b815bcd..2a1ccc6 100644
--- a/tasks.py
+++ b/tasks.py
@@ -16,6 +16,9 @@ celery = Celery('flask_user_reg', broker=broker_url)
 
 socketio = SocketIO(message_queue=vars.message_queue)
 
+def callback():
+    rc_util.rc_rmq.stop_consume()
+    rc_util.rc_rmq.delete_queue()
 
 def send_msg(event, room):
    print("Post '{}' to room '{}'".format(event,room))
@@ -35,18 +38,5 @@ def celery_create_account(json, session):
     print(username)
     rc_util.add_account(username, email, fullname, reason)
     print('sent account info')
-
-#       rc_util.consume(username)
-#       print(time.strftime("%m-%d-%Y_%H:%M:%S") + '\tAccount successfully created for ' + username)
-#       send_msg('account ready', room)
-#    return 
-
-#rc_util.add_account(args.username, email=args.email, full=args.full_name, reason=args.reason)
-#print(f'Account for {args.username} requested.')
-
-# Set initial timeout timer
-    signal.signal(signal.SIGALRM, timeout_handler)
-    signal.setitimer(signal.ITIMER_REAL, timeout)
-
     print('Waiting for completion...')
-    rc_util.consume(args.username, routing_key=f'complete.{args.username}', callback=callback) 
+    rc_util.consume(username, routing_key=f'complete.{username}', callback=callback) 
-- 
GitLab