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
d9c70a3e
Commit
d9c70a3e
authored
8 years ago
by
Piotr Maślanka
Browse files
Options
Downloads
Patches
Plain Diff
jab at bug
parent
14f5ce09
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
coolamqp/clustering/single.py
+1
-1
1 addition, 1 deletion
coolamqp/clustering/single.py
coolamqp/objects.py
+1
-0
1 addition, 0 deletions
coolamqp/objects.py
coolamqp/uplink/listener/thread.py
+14
-0
14 additions, 0 deletions
coolamqp/uplink/listener/thread.py
with
16 additions
and
1 deletion
coolamqp/clustering/single.py
+
1
−
1
View file @
d9c70a3e
...
@@ -43,7 +43,7 @@ class SingleNodeReconnector(object):
...
@@ -43,7 +43,7 @@ class SingleNodeReconnector(object):
return
return
self
.
connection
=
None
self
.
connection
=
None
self
.
connect
(
)
self
.
call_next_io_event
(
self
.
connect
)
def
shutdown
(
self
):
def
shutdown
(
self
):
"""
Close this connection
"""
"""
Close this connection
"""
...
...
This diff is collapsed.
Click to expand it.
coolamqp/objects.py
+
1
−
0
View file @
d9c70a3e
...
@@ -18,6 +18,7 @@ class Callable(object):
...
@@ -18,6 +18,7 @@ class Callable(object):
"""
"""
Add a bunch of callables to one list, and just invoke
'
m.
Add a bunch of callables to one list, and just invoke
'
m.
INTERNAL USE ONLY
INTERNAL USE ONLY
#todo not thread safe
"""
"""
def
__init__
(
self
,
oneshots
=
False
):
def
__init__
(
self
,
oneshots
=
False
):
...
...
This diff is collapsed.
Click to expand it.
coolamqp/uplink/listener/thread.py
+
14
−
0
View file @
d9c70a3e
...
@@ -4,6 +4,7 @@ from __future__ import absolute_import, division, print_function
...
@@ -4,6 +4,7 @@ from __future__ import absolute_import, division, print_function
import
threading
import
threading
from
coolamqp.uplink.listener.epoll_listener
import
EpollListener
from
coolamqp.uplink.listener.epoll_listener
import
EpollListener
from
coolamqp.objects
import
Callable
class
ListenerThread
(
threading
.
Thread
):
class
ListenerThread
(
threading
.
Thread
):
...
@@ -17,6 +18,18 @@ class ListenerThread(threading.Thread):
...
@@ -17,6 +18,18 @@ class ListenerThread(threading.Thread):
threading
.
Thread
.
__init__
(
self
,
name
=
'
coolamqp/ListenerThread
'
)
threading
.
Thread
.
__init__
(
self
,
name
=
'
coolamqp/ListenerThread
'
)
self
.
daemon
=
True
self
.
daemon
=
True
self
.
terminating
=
False
self
.
terminating
=
False
self
.
_call_next_io_event
=
Callable
(
oneshots
=
True
)
def
call_next_io_event
(
self
,
callable
):
"""
Call callable after current I/O event is fully processed
sometimes many callables are called in response to single
I/O (eg. teardown, startup). This guarantees a call after
all these are done.
:param callable: callable/0
"""
self
.
_call_next_io_event
()
def
terminate
(
self
):
def
terminate
(
self
):
self
.
terminating
=
True
self
.
terminating
=
True
...
@@ -28,6 +41,7 @@ class ListenerThread(threading.Thread):
...
@@ -28,6 +41,7 @@ class ListenerThread(threading.Thread):
def
run
(
self
):
def
run
(
self
):
while
not
self
.
terminating
:
while
not
self
.
terminating
:
self
.
listener
.
wait
(
timeout
=
1
)
self
.
listener
.
wait
(
timeout
=
1
)
self
.
listener
.
shutdown
()
self
.
listener
.
shutdown
()
def
register
(
self
,
sock
,
on_read
=
lambda
data
:
None
,
on_fail
=
lambda
:
None
):
def
register
(
self
,
sock
,
on_read
=
lambda
data
:
None
,
on_fail
=
lambda
:
None
):
...
...
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