alleyinteractive / alleyinteractive/elasticsearch-extensions
Replace `sleep()` with loop during index for VIP Search tests
- 主要语言
- PHP
- 星标
- 5
- 派生
- 0
- PR 合并指标
- 30 天内没有已合并 PR
描述
### Description
Currently, in order to create enough time for content to finish indexing for VIP Search tests, `sleep()` is used. This isn't the most time-effective manner of ensuring that the index is finished. Instead, we could write a loop with a set number of retries that queries for the posts in the index, and re-runs the loop up to N number of times until the item appears in the index. We [do something similar in SearchPress](https://github.com/alleyinteractive/searchpress/blob/main/tests/bootstrap.php#L29) which balances the need to wait for something to happen with the fact that it may not happen in the same amount of time all of the time and needing to put some kind of a sensible cap on it.
### Use Case
When indexing bootstrapped content in our tests, we should only wait as long as we need to for the indexing operation to finish before continuing to run the tests.
贡献指南
评估
这个 Issue 还没有评估数据。