Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
feudal
feudalBackend
Commits
11572b13
Commit
11572b13
authored
Mar 01, 2018
by
Lukas Burgey
Browse files
Add checks for the rabbitmq connection and channel
parent
9d568e9e
Changes
1
Hide whitespace changes
Inline
Side-by-side
django_backend/backend/models.py
View file @
11572b13
...
...
@@ -69,7 +69,11 @@ class RabbitMQInstance(models.Model):
@
property
def
connection
(
self
):
if
self
.
rabbitmq_connection
is
None
:
if
(
self
.
rabbitmq_connection
is
None
or
self
.
rabbitmq_connection
.
is_closed
or
self
.
rabbitmq_connection
.
is_closing
):
rabbitmqconnection_properties
=
pika
.
ConnectionParameters
(
host
=
self
.
host
,
ssl
=
True
,
...
...
@@ -83,7 +87,11 @@ class RabbitMQInstance(models.Model):
@
property
def
channel
(
self
):
if
self
.
rabbitmq_channel
is
None
:
if
(
self
.
rabbitmq_channel
is
None
or
self
.
rabbitmq_channel
.
is_closed
or
self
.
rabbitmq_channel
.
is_closing
):
self
.
rabbitmq_channel
=
self
.
connection
.
channel
()
self
.
rabbitmq_channel
.
exchange_declare
(
exchange
=
self
.
exchange
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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