Skip to content

Commit ae91327

Browse files
committed
Minor simplification
1 parent a91e4b2 commit ae91327

File tree

1 file changed

+16
-21
lines changed

1 file changed

+16
-21
lines changed

src/graphql/execution/execute.py

+16-21
Original file line numberDiff line numberDiff line change
@@ -1709,7 +1709,6 @@ async def await_data(
17091709
awaitable: Awaitable[Dict[str, Any]],
17101710
) -> Optional[Dict[str, Any]]:
17111711
# noinspection PyShadowingNames
1712-
17131712
try:
17141713
return await awaitable
17151714
except GraphQLError as error:
@@ -2607,16 +2606,14 @@ async def wait(self) -> Optional[Dict[str, Any]]:
26072606
if self.parent_context:
26082607
await self.parent_context.completed.wait()
26092608
_data = self._data
2610-
try:
2611-
data = (
2612-
await _data # type: ignore
2613-
if self._context.is_awaitable(_data)
2614-
else _data
2615-
)
2616-
finally:
2617-
await sleep(ASYNC_DELAY) # always defer completion a little bit
2618-
self.data = data
2619-
self.completed.set()
2609+
data = (
2610+
await _data # type: ignore
2611+
if self._context.is_awaitable(_data)
2612+
else _data
2613+
)
2614+
await sleep(ASYNC_DELAY) # always defer completion a little bit
2615+
self.completed.set()
2616+
self.data = data
26202617
return data
26212618

26222619
def add_data(self, data: AwaitableOrValue[Optional[Dict[str, Any]]]) -> None:
@@ -2680,16 +2677,14 @@ async def wait(self) -> Optional[List[str]]:
26802677
if self.parent_context:
26812678
await self.parent_context.completed.wait()
26822679
_items = self._items
2683-
try:
2684-
items = (
2685-
await _items # type: ignore
2686-
if self._context.is_awaitable(_items)
2687-
else _items
2688-
)
2689-
finally:
2690-
await sleep(ASYNC_DELAY) # always defer completion a little bit
2691-
self.items = items
2692-
self.completed.set()
2680+
items = (
2681+
await _items # type: ignore
2682+
if self._context.is_awaitable(_items)
2683+
else _items
2684+
)
2685+
await sleep(ASYNC_DELAY) # always defer completion a little bit
2686+
self.items = items
2687+
self.completed.set()
26932688
return items
26942689

26952690
def add_items(self, items: AwaitableOrValue[Optional[List[Any]]]) -> None:

0 commit comments

Comments
 (0)