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

[Typesense] Sync server state in getOrCreateCollectionFromModel #845 #846

Merged
merged 3 commits into from
Jul 10, 2024

Conversation

tharropoulos
Copy link
Contributor

Updates the getOrCreateCollectionFromModel method in TypesenseEngine to verify if a collection exists on the server. If not found, it is created. This ensures consistency between the worker and server, fixing queue workers not being able to import after flushing, as mentioned in #845.

tharropoulos and others added 3 commits July 10, 2024 17:12
This commit updates the `getOrCreateCollectionFromModel` method in
`TypesenseEngine` to verify if a collection exists on the server. If not
found, it is created. This ensures consistency between the worker and
server states.
refactor: remove uneeded cast of flag

The collectionExists flag was already cast as false, so recasting it
serves no purpose
@taylorotwell taylorotwell merged commit b3783c2 into laravel:10.x Jul 10, 2024
12 of 13 checks passed
saibotk added a commit to saibotk/scout that referenced this pull request Jul 12, 2024
In //laravel#820 we introduced an exists check method, which then lead to static state issues as described in laravel#845

Those where addressed in laravel#846

But now that the function always double-checks the existence, we can remove the exists check entirely and only rely on the Typesense server response for this state.

This "fixes" issues where the server already has a collection and the client would try to recreate it. E.g. when it has flushed the index and another process or worker then creates the collection.
saibotk added a commit to saibotk/scout that referenced this pull request Jul 12, 2024
In laravel#820 we introduced an exists check method, which then lead to static state issues as described in laravel#845

Those where addressed in laravel#846

But now that the function always double-checks the existence, we can remove the exists check entirely and only rely on the Typesense server response for this state.

This "fixes" issues where the server already has a collection and the client would try to recreate it. E.g. when it has flushed the index and another process or worker then creates the collection.
saibotk added a commit to saibotk/scout that referenced this pull request Jul 12, 2024
In laravel#820 we introduced an exists check method, which then lead to static state issues as described in laravel#845

Those where addressed in laravel#846

But now that the function always double-checks the existence, we can remove the exists check entirely and only rely on the Typesense server response for this state.

This "fixes" issues where the server already has a collection and the client would try to recreate it. E.g. when it has flushed the index and another process or worker then creates the collection.
saibotk added a commit to saibotk/scout that referenced this pull request Jul 12, 2024
In laravel#820 we introduced an exists check method, which then lead to static state issues as described in laravel#845

Those where addressed in laravel#846

But now that the function always double-checks the existence, we can remove the exists check entirely and only rely on the Typesense server response for this state.

This "fixes" issues where the server already has a collection and the client would try to recreate it. E.g. when it has flushed the index and another process or worker then creates the collection.
taylorotwell added a commit that referenced this pull request Aug 5, 2024
* refactor(typesense): remove unused exists checks

In #820 we introduced an exists check method, which then lead to static state issues as described in #845

Those where addressed in #846

But now that the function always double-checks the existence, we can remove the exists check entirely and only rely on the Typesense server response for this state.

This "fixes" issues where the server already has a collection and the client would try to recreate it. E.g. when it has flushed the index and another process or worker then creates the collection.

* Update TypesenseEngine.php

---------

Co-authored-by: Taylor Otwell <[email protected]>
@AbdullahFaqeir
Copy link
Contributor

Hi everybody,

I'll be working on this ASAP, apologise for all the time taken.

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