Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
coolamqp
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
public
coolamqp
Commits
764237d1
Commit
764237d1
authored
9 years ago
by
Piotr Maślanka
Browse files
Options
Downloads
Patches
Plain Diff
added flag that tells if connected to broker
parent
c3201642
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
coolamqp/cluster.py
+2
-0
2 additions, 0 deletions
coolamqp/cluster.py
coolamqp/handler.py
+3
-0
3 additions, 0 deletions
coolamqp/handler.py
with
5 additions
and
0 deletions
coolamqp/cluster.py
+
2
−
0
View file @
764237d1
...
...
@@ -66,6 +66,8 @@ class Cluster(object):
self
.
backend
=
backend
self
.
node_to_connect_to
=
itertools
.
cycle
(
nodes
)
self
.
connected
=
False
#: public, is connected to broker?
from
.handler
import
ClusterHandlerThread
self
.
thread
=
ClusterHandlerThread
(
self
)
...
...
This diff is collapsed.
Click to expand it.
coolamqp/handler.py
+
3
−
0
View file @
764237d1
...
...
@@ -65,6 +65,7 @@ class ClusterHandlerThread(threading.Thread):
except
ConnectionFailedError
as
e
:
# a connection failure happened :(
logger
.
warning
(
'
Connecting to %s failed due to %s
'
,
node
,
repr
(
e
))
self
.
cluster
.
connected
=
False
if
self
.
backend
is
not
None
:
self
.
backend
.
shutdown
()
self
.
backend
=
None
# good policy to release resources before you sleep
...
...
@@ -78,6 +79,7 @@ class ClusterHandlerThread(threading.Thread):
else
:
exponential_backoff_delay
=
60
else
:
self
.
cluster
.
connected
=
True
self
.
event_queue
.
put
(
ConnectionUp
())
break
# we connected :)
...
...
@@ -140,6 +142,7 @@ class ClusterHandlerThread(threading.Thread):
except
ConnectionFailedError
as
e
:
logger
.
warning
(
'
Connection to broker lost
'
)
self
.
cluster
.
connected
=
True
self
.
event_queue
.
put
(
ConnectionDown
())
self
.
_reconnect
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment