Skip to content

Removed invalid await from grpc async call - #785

Merged
joein merged 2 commits into
qdrant:devfrom
VanaMartin:fix-invalid-grpc-await
Sep 24, 2024
Merged

Removed invalid await from grpc async call#785
joein merged 2 commits into
qdrant:devfrom
VanaMartin:fix-invalid-grpc-await

Conversation

@VanaMartin

Copy link
Copy Markdown
Contributor

All Submissions:

  • Contributions should target the dev branch. Did you create your branch from dev?
  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

Changes to Core Features:

This PR only removes invalid await clause from initialising grpc request. The existing await was causing folowing exception (on version 1.11.2):

   2597     if isinstance(shard_key, get_args_subscribed(models.ShardKey)):
   2598         shard_key = RestToGrpc.convert_shard_key(shard_key)
-> 2599     request = await grpc.CreateShardKey(
   2600         shard_key=shard_key,
   2601         shards_number=shards_number,
   2602         replication_factor=replication_factor,
   2603         placement=placement or [],
   2604     )
   2605     return (
   2606         await self.grpc_collections.CreateShardKey(
   2607             grpc.CreateShardKeyRequest(
   (...)
   2611         )
   2612     ).result
   2613 else:

TypeError: object CreateShardKey can't be used in 'await' expression

I've tested the local behaviour with a positive result.

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully ran tests with your changes locally?

@netlify

netlify Bot commented Sep 24, 2024

Copy link
Copy Markdown

Deploy Preview for poetic-froyo-8baba7 ready!

Name Link
🔨 Latest commit bb5fd65
🔍 Latest deploy log https://app.netlify.com/sites/poetic-froyo-8baba7/deploys/66f2e89a07687b0008dab419
😎 Deploy Preview https://deploy-preview-785--poetic-froyo-8baba7.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@joein

joein commented Sep 24, 2024

Copy link
Copy Markdown
Member

Hi @VanaMartin

Thank you for your contribution

However, we can't accept it right now, because async client is auto-generated from sync client and changes to async files can't be done without altering either sync client or generator code

We'll investigate the issue

@joein

joein commented Sep 24, 2024

Copy link
Copy Markdown
Member

I have found and fixed the issue and extended tests coverage

@joein
joein requested review from coszio and joein September 24, 2024 16:41
@joein
joein merged commit 8ad5574 into qdrant:dev Sep 24, 2024
joein added a commit that referenced this pull request Sep 24, 2024
* Removed invalid await from grpc async call

* fix: fix generation of grpc async create shard key, add tests

---------

Co-authored-by: George Panchuk <george.panchuk@qdrant.tech>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants