We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent aadf370 commit fd2b081Copy full SHA for fd2b081
src/Scout/ScoutEngine.php
@@ -44,6 +44,7 @@
44
use function sleep;
45
use function sprintf;
46
use function substr;
47
+use function time;
48
49
/**
50
* In the context of this Laravel Scout engine, a "search index" refers to
@@ -526,8 +527,9 @@ private function usesSoftDelete(Model|EloquentCollection $model): bool
526
527
*/
528
private function wait(Closure $callback): void
529
{
- $timeout = hrtime()[0] + self::WAIT_TIMEOUT_SEC;
530
- while (hrtime()[0] < $timeout) {
+ // Fallback to time() if hrtime() is not supported
531
+ $timeout = (hrtime()[0] ?? time()) + self::WAIT_TIMEOUT_SEC;
532
+ while ((hrtime()[0] ?? time()) < $timeout) {
533
if ($callback()) {
534
return;
535
}
0 commit comments