Skip to content

Commit

Permalink
Update documentation (#713)
Browse files Browse the repository at this point in the history
## What do these changes do?

This PR updates the documentation to reflect the latest changes:
recommends to use the new `aclose()` method (ad2b1bd) and clarifies that
the slowdown "can be", but not necessarily "will be" (4a57895). In fact,
in no-wait tests Janus can now be comparable to standard queues, but in
worst cases where notification methods are often called, it can still
show significant performance slowdown, so "only when used as intended"
remains. In particular, in Culsans benchmarks Janus is still slower than
the naive solution.

## Are there changes in behavior for the user?

There are no behavior changes for users.
  • Loading branch information
x42005e1f authored Dec 10, 2024
1 parent 4a57895 commit b1e6e0f
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ Example
fut = loop.run_in_executor(None, threaded, queue.sync_q)
await async_coro(queue.async_q)
await fut
queue.close()
await queue.wait_closed()
await queue.aclose()
asyncio.run(main())
Expand All @@ -83,16 +82,16 @@ This library is built using a classic thread-safe design. The design is
time-tested, but has some limitations.

* Once you are done working with a queue, you must properly close it using
``close()`` and ``wait_closed()``. This is because this library creates new
tasks to notify other threads. If you do not properly close the queue,
``aclose()``. This is because this library creates new tasks to notify other
threads. If you do not properly close the queue,
`asyncio may generate error messages
<https://github.com/aio-libs/janus/issues/574>`_.
* The library has acceptable performance only when used as intended, that is,
for communication between synchronous code and asynchronous one.
For sync-only and async-only cases, use queues from
`queue <https://docs.python.org/3/library/queue.html>`_ and
`asyncio <https://docs.python.org/3/library/asyncio-queue.html>`_ modules,
otherwise `the slowdown will be significant
otherwise `the slowdown can be significant
<https://github.com/aio-libs/janus/issues/419>`_.
* You cannot use queues for communicating between two different event loops
because, like all asyncio primitives, they bind to the current one.
Expand Down

0 comments on commit b1e6e0f

Please sign in to comment.