Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
rc
self-reg-form
Commits
6fddb9de
Commit
6fddb9de
authored
Apr 02, 2021
by
root
Browse files
added timeout function on client end
parent
fefcf1a8
Changes
1
Hide whitespace changes
Inline
Side-by-side
tasks.py
View file @
6fddb9de
...
...
@@ -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
=
6
0
timeout
=
3
0
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
)
rc_util
.
rc_rmq
.
stop_consume
()
rc_util
.
rc_rmq
.
delete_queue
()
@
celery
.
task
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"
)
+
'
\t
User '
+
username
+
' added to queue'
)
send_msg
(
'creating account'
,
room
)
signal
.
signal
(
signal
.
SIGALRM
,
timeout_handler
)
signal
.
setitimer
(
signal
.
ITIMER_REAL
,
timeout
)
print
(
username
)
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
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment