Skip to content

Commit

Permalink
Merge branch 'feature/doc' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Tishka17 committed Feb 14, 2024
2 parents 24aaabf + 741d0e1 commit fb929b8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/container/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Basic usage

Container can be synchronous or asynchronous.

* *Async* container can use any type of dependency sources: both sync and async are supported. Sync methods are called directly and no executors are used, so avoid network I/O in synchrous functions
* *Async* container can use any type of dependency sources: both sync and async are supported. Sync methods are called directly and no executors are used, so avoid network I/O in synchronous functions
* *Sync* container can use only synchronous dependency sources.

To create a top level container you should call ``make_container`` (or ``make_async_container``) and use it as a context manager. Pass there one or more providers.
Expand Down Expand Up @@ -53,9 +53,9 @@ Thread/task safety

You can have multiple containers of the same scope simultaneously (except the top level one) - it is safe while you do not have dependencies of previous scope.

For example, if you have declared ``SessionPool`` as an APP-scoped dependency and then you concurrently enter REQUEST scope. Once you request ``SessionPool`` for the first time (directly or for another dependency) you cannot gurantee that only one instance of that object is created.
For example, if you have declared ``SessionPool`` as an APP-scoped dependency and then you concurrently enter REQUEST scope. Once you request ``SessionPool`` for the first time (directly or for another dependency) you cannot guarantee that only one instance of that object is created.

To prevent such a condition you need to protect any session whose children can be used concurrently: to pass ``lock_factory`` when creating a container. Do not mix up threadin and asyncio locks: they are interchangeable, use the proper one.
To prevent such a condition you need to protect any session whose children can be used concurrently: to pass ``lock_factory`` when creating a container. Do not mix up threading and asyncio locks: they are not interchangeable, use the proper one.


.. code-block:: python
Expand Down

0 comments on commit fb929b8

Please sign in to comment.