Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sjrpc
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mirror
sjrpc
Commits
b10413f5
Commit
b10413f5
authored
13 years ago
by
Antoine Millet
Browse files
Options
Downloads
Patches
Plain Diff
Fixed bugs with ReST notes.
parent
879f5c8f
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
doc/fundamentals.rst
+1
-0
1 addition, 0 deletions
doc/fundamentals.rst
sjrpc/core/async.py
+13
-10
13 additions, 10 deletions
sjrpc/core/async.py
with
14 additions
and
10 deletions
doc/fundamentals.rst
+
1
−
0
View file @
b10413f5
...
...
@@ -82,6 +82,7 @@ can disable this behavior with the `disable_fallback` parameter of the
a special rpc message "capabilities" is received.
.. note::
When the fallback mode is enabled, you can't use another protocols than the
default rpc. All calls to :meth:`RpcConnection.register_protocol`,
:meth:`RpcConnection.unregister_protocol`, :meth:`RpcConnection.create_rpc`
...
...
This diff is collapsed.
Click to expand it.
sjrpc/core/async.py
+
13
−
10
View file @
b10413f5
...
...
@@ -9,11 +9,13 @@ class AsyncWatcher(object):
'''
Asynchronous call watcher -- Handle asynchronous calls and responses.
Usage example:
>>>
watcher
=
AsyncWatcher
()
>>>
watcher
.
register
(
conn1
,
'
ping
'
)
>>>
watcher
.
register
(
conn2
,
'
ping
'
)
>>>
responses
=
watcher
.
wait
()
# Wait for all responses
Usage example::
>>>
watcher
=
AsyncWatcher
()
>>>
watcher
.
register
(
conn1
,
'
ping
'
)
>>>
watcher
.
register
(
conn2
,
'
ping
'
)
>>>
responses
=
watcher
.
wait
()
# Wait for all responses
'''
def
__init__
(
self
):
...
...
@@ -64,14 +66,15 @@ class AsyncWatcher(object):
:return: received messages in a list
.. note::
You can repeat call to this method on a single
:class:`AsyncWatcher`. For example, if you want to process the
first arrived message, then wait others for a minute, you can do:
first arrived message, then wait others for a minute, you can do:
:
>>>
msgs
=
watcher
.
wait
(
max_wait
=
1
)
>>>
process_speedy
(
msgs
[
0
])
>>>
for
msg
in
watcher
.
wait
(
timeout
=
60
):
>>>
process
(
msg
)
>>>
msgs
=
watcher
.
wait
(
max_wait
=
1
)
>>>
process_speedy
(
msgs
[
0
])
>>>
for
msg
in
watcher
.
wait
(
timeout
=
60
):
>>>
process
(
msg
)
'''
responses
=
[]
while
self
.
remains
:
...
...
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