Skip to content

Commit 19e4add

Browse files
committed
Fixing DjangoConnection
1 parent 58b92e6 commit 19e4add

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

graphene_django/fields.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,10 @@ async def resolve_connection_async(iterable):
266266
iterable = await iterable
267267
if iterable is None:
268268
iterable = default_manager
269-
## This could also be async
270-
iterable = queryset_resolver(connection, iterable, info, args)
269+
270+
iterable = await sync_to_async(queryset_resolver)(
271+
connection, iterable, info, args
272+
)
271273

272274
if info.is_awaitable(iterable):
273275
iterable = await iterable
@@ -280,19 +282,21 @@ async def resolve_connection_async(iterable):
280282

281283
if iterable is None:
282284
iterable = default_manager
283-
# thus the iterable gets refiltered by resolve_queryset
284-
# but iterable might be promise
285-
iterable = queryset_resolver(connection, iterable, info, args)
286285

287286
try:
288287
get_running_loop()
289288
except RuntimeError:
290289
pass
291290
else:
291+
iterable = sync_to_async(queryset_resolver)(
292+
connection, iterable, info, args
293+
)
292294
return sync_to_async(cls.resolve_connection)(
293295
connection, args, iterable, max_limit=max_limit
294296
)
295297

298+
iterable = queryset_resolver(connection, iterable, info, args)
299+
296300
return cls.resolve_connection(connection, args, iterable, max_limit=max_limit)
297301

298302
def wrap_resolve(self, parent_resolver):

0 commit comments

Comments
 (0)