Commit 6fddb9de authored by root's avatar root
Browse files

added timeout function on client end

parent fefcf1a8
......@@ -14,7 +14,7 @@ broker_url = vars.broker_url
celery = Celery('flask_user_reg', broker=broker_url)
socketio = SocketIO(message_queue=vars.message_queue)
timeout = 60
timeout = 30
def gen_f(room):
def callback(channel, method, properties, body):
......@@ -40,7 +40,9 @@ def send_msg(event, room):
def timeout_handler(signum, frame):
print("Process timeout, there's might some issue with agents")
socketio.emit('account error', errmsg, room= room)
def celery_create_account(json, session):
......@@ -52,11 +54,11 @@ def celery_create_account(json, session):
print(time.strftime("%m-%d-%Y_%H:%M:%S") + '\tUser ' + username + ' added to queue')
send_msg('creating account', room)
signal.signal(signal.SIGALRM, timeout_handler)
signal.setitimer(signal.ITIMER_REAL, timeout)
rc_util.add_account(username, email, fullname, reason)
print('sent account info')
print('Waiting for completion...')
#print(callback(self.EXCHANGE, self.EXCHANGE,self.EXCHANGE,self.EXCHANGE))
rc_util.consume(username, routing_key=f'complete.{username}', callback=gen_f(room))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment