File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
libraries/microsoft-agents-storage-cosmos/microsoft_agents/storage/cosmos Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change 22# Licensed under the MIT License.
33
44from typing import TypeVar , Union
5- from threading import Lock
5+ import asyncio
66
77from azure .cosmos import (
88 documents ,
@@ -49,7 +49,7 @@ def __init__(self, config: CosmosDBStorageConfig):
4949 self ._container : ContainerProxy = None
5050 self ._compatability_mode_partition_key : bool = False
5151 # Lock used for synchronizing container creation
52- self ._lock : Lock = Lock ()
52+ self ._lock : asyncio . Lock = asyncio . Lock ()
5353
5454 def _create_client (self ) -> CosmosClient :
5555 if self ._config .url :
@@ -164,8 +164,8 @@ async def _create_container(self) -> None:
164164
165165 async def initialize (self ) -> None :
166166 if not self ._container :
167- with self ._lock :
168- # in case another thread attempted to initialize just before acquiring the lock
167+ async with self ._lock :
168+ # in case another async task attempted to initialize just before acquiring the lock
169169 if self ._container :
170170 return
171171
You can’t perform that action at this time.
0 commit comments