Skip to content

Commit

Permalink
Fix detected blocking call inside the event loop
Browse files Browse the repository at this point in the history
  • Loading branch information
chemelli74 committed Jun 13, 2024
1 parent 0f77892 commit b9611bf
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions aiobotocore/session.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import asyncio
import functools

from botocore import UNSIGNED
from botocore import __version__ as botocore_version
from botocore import translate
from botocore.exceptions import PartialCredentialsError
from botocore.loaders import Loader
from botocore.session import EVENT_ALIASES, ServiceModel
from botocore.session import Session as _SyncSession
from botocore.session import UnknownServiceError, copy
Expand Down Expand Up @@ -103,9 +107,11 @@ async def get_service_data(self, service_name, api_version=None):
Retrieve the fully merged data associated with a service.
"""
data_path = service_name
service_data = self.get_component('data_loader').load_service_model(
data_loader: Loader = self.get_component('data_loader')
loop = asyncio.get_event_loop()
service_data = await loop.run_in_executor(None, functools.partial(data_loader.load_service_model,
data_path, type_name='service-2', api_version=api_version
)
))
service_id = EVENT_ALIASES.get(service_name, service_name)
await self._events.emit(
'service-data-loaded.%s' % service_id,
Expand Down

0 comments on commit b9611bf

Please sign in to comment.