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

refactor(client/index): expose wait_task on the client #343

Closed
wants to merge 1 commit into from

Conversation

PLNech
Copy link
Member

@PLNech PLNech commented Mar 28, 2018

Exposes wait_task on clients, to avoid requiring an index reference for an operation that does not need it.

The end goal is to leverage it in algoliasearch_django, to avoid code like this:

    def test_delete_signal(self):
        Website.objects.create(name='Algolia', url='https://www.algolia.com')
        Website.objects.create(name='Google', url='https://www.google.com')
        Website.objects.create(name='Facebook', url='https://www.facebook.com')

        Website.objects.get(name='Algolia').delete()
        Website.objects.get(name='Facebook').delete()

        time.sleep(10)
        result = raw_search(Website)
        self.assertEqual(result['nbHits'], 1)
        self.assertEqual(result['hits'][0]['name'], 'Google')

@julienbourdeau
Copy link
Contributor

In PHP, we use the path following path

'/1/indexes/'.$indexName.'/task/'.$taskID

It would be interesting to know if there is any difference between the 2 and which one is recommended.

@julienbourdeau
Copy link
Contributor

It seems like we always need the index name to be able to test a taskID. This refactor was introduce with AB Tests (where having wait_task on the client came handy too).
Thanks PLN for the inputs 🙌

88f9b98

@PLNech PLNech deleted the feat/waitTaskOnIndex branch June 20, 2018 10:51
@iamr0b0tx
Copy link

see here maybe it can help

shortcuts added a commit that referenced this pull request Nov 24, 2023
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.

None yet

3 participants