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

fix(prepareTotalCount): infinite loop #238

Closed
wants to merge 2 commits into from
Closed

Conversation

tunecino
Copy link
Contributor

@tunecino tunecino commented Jun 23, 2019

related to #134 and #201.

There is currently an infinite loop that happens when following method is called before getting any results from ElasticSearch:

prepareModels()
->getPagination()
->prepareTotalCount()
->getQueryResults()
->prepare()
->prepareModels()

It seems the infinite loop issue has already been fixed at some point, but then reverted by 58466a8.

This PR tries a different fix to the same issue by simply ensuring prepareTotalCount() to request the number from database in case there is no available query response, the exact same way it was done with core ActiveDataProvider::prepareTotalCount() for SQL databases, Mongo and Sphinx extensions.

Q A
Is bugfix? yes
New feature? no
Breaks BC? no
Tests pass? (good question)
Fixed issues #134,#201

tunecino added 2 commits June 23, 2019 12:38
related to yiisoft#134 and yiisoft#201.

There is currently an infinite loop that happens when following method is called before getting any results from ElasticSearch:

```
prepareModels()
->getPagination()
->prepareTotalCount()
->getQueryResults()
->prepare()
->prepareModels()
```

It seems the infinite loop issue has already been fixed at some point, but then reverted by yiisoft@58466a8.

This PR tries a different fix to the same issue by simply ensuring `prepareTotalCount()` to request the number from the database in case we have no available query response, the exact same way it was done with core `ActiveDataProvider::prepareTotalCount()` for SQL databases, Mongo and Sphinx extensions.
@samdark
Copy link
Member

samdark commented Jun 24, 2019

@tunecino can you update Yii to latest version and re-check? The code was reverted because that change in the core was reverted.

@tunecino
Copy link
Contributor Author

Oops! The project was way behind latest release. All works fine now after core framework being upgraded from v2.0.16 to v2.0.21. I guess this can be closed. Thanks @samdark.

@tunecino tunecino closed this Jun 24, 2019
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.

2 participants