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 5ff73e6
Show file tree
Hide file tree
Showing 2 changed files with 5 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
10 changes: 4 additions & 6 deletions graphene_mongo/tests/test_relay_query.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import json
import base64

import graphene
import pytest

Expand Down Expand Up @@ -268,12 +269,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 5ff73e6

Please sign in to comment.