Skip to content

Commit

Permalink
docs: change sync-to-thread-info.rst wording about sync_to_thread
Browse files Browse the repository at this point in the history
  • Loading branch information
sobolevn authored and provinzkraut committed Oct 15, 2024
1 parent fdb4f3d commit 526722a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions docs/admonitions/sync-to-thread-info.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@
running the event loop, and in turn block the whole application.

To mitigate this, the ``sync_to_thread`` parameter can be set to ``True``, which
will result in the function being run in a thread pool. Should the function be
non-blocking, ``sync_to_thread`` should be set to ``False`` instead.
will result in the function being run in a thread pool.

If a synchronous function is non-blocking, setting ``sync_to_thread`` to ``False``
will tell Litestar that the user is sure about its behavior
and the function can be treated as non-blocking.

If a synchronous function is passed, without setting an explicit ``sync_to_thread``
value, a warning will be raised.
Expand Down

0 comments on commit 526722a

Please sign in to comment.