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
662ec894
Unverified
Commit
662ec894
authored
1 year ago
by
Piotr Maślanka
Browse files
Options
Downloads
Patches
Plain Diff
fixed #22
parent
2d69f81f
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
CHANGELOG.md
+1
-0
1 addition, 0 deletions
CHANGELOG.md
coolamqp/__init__.py
+1
-1
1 addition, 1 deletion
coolamqp/__init__.py
coolamqp/objects.py
+10
-8
10 additions, 8 deletions
coolamqp/objects.py
with
12 additions
and
9 deletions
CHANGELOG.md
+
1
−
0
View file @
662ec894
...
...
@@ -4,3 +4,4 @@ have been made so far, between releases.
# v1.3.1
*
coolamqp.objects.Callable made threadsafe (fixes #22)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
coolamqp/__init__.py
+
1
−
1
View file @
662ec894
__version__
=
'
1.3.1a
1
'
__version__
=
'
1.3.1a
2
'
This diff is collapsed.
Click to expand it.
coolamqp/objects.py
+
10
−
8
View file @
662ec894
...
...
@@ -3,6 +3,7 @@
Core objects used in CoolAMQP
"""
import
logging
import
threading
import
typing
as
tp
import
uuid
...
...
@@ -33,23 +34,24 @@ class Callable(object):
"""
Add a bunch of callables to one list, and just invoke
'
m.
INTERNAL USE ONLY
#todo not thread safe
"""
__slots__
=
(
'
callables
'
,
'
oneshots
'
)
__slots__
=
(
'
callables
'
,
'
oneshots
'
,
'
lock
'
)
def
__init__
(
self
,
oneshots
=
False
):
"""
:param oneshots: if True, callables will be called and discarded
"""
self
.
callables
=
[]
self
.
lock
=
threading
.
Lock
()
self
.
oneshots
=
oneshots
def
add
(
self
,
c
alla
bl
e
):
self
.
callables
.
append
(
c
alla
bl
e
)
def
add
(
self
,
c
l
bl
):
self
.
callables
.
append
(
c
l
bl
)
def
__call__
(
self
,
*
args
,
**
kwargs
):
for
callable
in
self
.
callables
:
callable
(
*
args
,
**
kwargs
)
if
self
.
oneshots
:
self
.
callables
=
[]
with
self
.
lock
:
for
clbl
in
self
.
callables
:
clbl
(
*
args
,
**
kwargs
)
if
self
.
oneshots
:
self
.
callables
=
[]
class
Message
(
object
):
...
...
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