Skip to content

Commit

Permalink
Bug Fix on connection_resolver
Browse files Browse the repository at this point in the history
  • Loading branch information
arunsureshkumar committed Apr 11, 2023
1 parent ec3e60e commit 60a9e7f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
3 changes: 1 addition & 2 deletions graphene_mongo/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -563,8 +563,7 @@ async def connection_resolver(cls, resolver, connection_type, root, info, **args
connection_type = connection_type.of_type
if Promise.is_thenable(iterable):
on_resolve = partial(cls.resolve_connection, connection_type, args)
return Promise.resolve(iterable).then(on_resolve)

iterable = Promise.resolve(iterable).then(on_resolve).value
return await sync_to_async(cls.resolve_connection, thread_sensitive=False,
executor=ThreadPoolExecutor())(connection_type, args, iterable)

Expand Down
12 changes: 6 additions & 6 deletions graphene_mongo/tests/test_relay_query.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import os
import json
import base64
from concurrent.futures import ThreadPoolExecutor

import graphene
import pytest
from asgiref.sync import sync_to_async

from graphene.relay import Node
from graphql_relay.node.node import to_global_id
Expand Down Expand Up @@ -268,12 +271,9 @@ class Query(graphene.ObjectType):
}
}
schema = graphene.Schema(query=Query)
try:
result = await schema.execute_async(query)
assert not result.errors
assert result.data == expected
except Exception as error:
a = error
result = await schema.execute_async(query)
assert not result.errors
assert result.data == expected


@pytest.mark.asyncio
Expand Down

0 comments on commit 60a9e7f

Please sign in to comment.