Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Asynchronous Environments? #12

Open
dhrumilp15 opened this issue Jul 7, 2021 · 6 comments
Open

Support for Asynchronous Environments? #12

dhrumilp15 opened this issue Jul 7, 2021 · 6 comments

Comments

@dhrumilp15
Copy link

Description

This is more of a question/enhanchement! Does typesense-python have support for asynchronous environments?

By this I mean:

  • Are functions that change search indices (save/delete objects, creating/deleting a new index) blocking?
  • Algolia is synchronous "by design" and many index functions place tasks into a queue to be processed - does Typesense do something similar?
@kishorenc
Copy link
Member

@dhrumilp15 Typesense backend API is synchronous in nature. For a large number of use cases this is more convenient as you get to know the result of an operation immediately, instead of having to make one more API call to look up the status.

The Python client is also synchronous, so when you call a method on the client, it will block until the response arrives or the operation times out.

Can you please help me understand how asynchronous operations will be helpful to your use case? That will help us prioritize future work.

@vd2org
Copy link

vd2org commented Jul 17, 2021

This does not mean that the API itself has to be asynchronous. This means support for asyncio for using the api in asynchronous applications like FastAPI.

@vd2org
Copy link

vd2org commented Jul 17, 2021

You can take a look at my async library for CouchDB, which is designed in much the same way as yours, but for an async environment:

https://github.com/vd2org/wheelchair

@haoyun
Copy link

haoyun commented Dec 24, 2021

I found a project https://github.com/devtud/aio_typesense that does the job.
i hope, howevr, async/await will be officially supported in typesens-python.

@trollfot
Copy link

I am poking a dead horse, here, but I started my own implementation, based on aio_typesense that I updated and heavily modified.

https://github.com/trollfot/typesense_aio

Feel free to jump in

@mgraczyk
Copy link

mgraczyk commented Feb 7, 2024

I forked to add async in such a way that it will be easy for me to keep the fork up to date:

https://github.com/Quilt-AI/typesense-python

This doesn't require many changes to the current codebase. Supporting both at the same time would be slightly more annoying/complicated but definitely doable.

Others are welcome to fork or use it. I think httpx or aiohttp like I have done is the way to go.

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

No branches or pull requests

6 participants