Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
feudal
feudalBackend
Commits
11572b13
Commit
11572b13
authored
Mar 01, 2018
by
Lukas Burgey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add checks for the rabbitmq connection and channel
parent
9d568e9e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
2 deletions
+10
-2
django_backend/backend/models.py
django_backend/backend/models.py
+10
-2
No files found.
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
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