-
-
Notifications
You must be signed in to change notification settings - Fork 270
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
🐛 Fixed issues with incremental indexer command #561
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #561 +/- ##
============================================
- Coverage 57.24% 56.99% -0.25%
- Complexity 1391 1396 +5
============================================
Files 340 340
Lines 5669 5697 +28
============================================
+ Hits 3245 3247 +2
- Misses 2424 2450 +26 ☔ View full report in Codecov by Sentry. |
private function sleep(int $milliseconds): void | ||
{ | ||
$interval = 100; // check every 100 ms | ||
$elapsed = 0; | ||
|
||
while ($elapsed < $milliseconds) | ||
{ | ||
if ($this->cancelled) | ||
{ | ||
return; | ||
} | ||
|
||
usleep($interval * 1000); | ||
$elapsed += $interval; | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pushrbx Is this hack specific to docker containers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, would it make sense to move this to helpers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just wanted to have a sleep function which can be cancelled. Anytime you cancel the process, it should gracefully exit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll move this to helpers.
private function sleep(int $milliseconds): void | ||
{ | ||
$interval = 100; // check every 100 ms | ||
$elapsed = 0; | ||
|
||
while ($elapsed < $milliseconds) | ||
{ | ||
if ($this->cancelled) | ||
{ | ||
return; | ||
} | ||
|
||
usleep($interval * 1000); | ||
$elapsed += $interval; | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, would it make sense to move this to helpers?
|
||
while ($elapsed < $milliseconds) | ||
{ | ||
if ($this->cancelled) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we return 1
and use $log->fail()
instead?
https://laravel.com/docs/11.x/artisan#exit-codes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both of us are wrong. https://tldp.org/LDP/abs/html/exitcodes.html
This should be 128 + {the signal received}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The command had several issues. Also interestingly signal trapping doesn't work in lumen projects, so I had to add a hack.