mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 15:03:25 +00:00
Remove sleep calls
This commit is contained in:
@@ -544,13 +544,14 @@ abstract class task_abstract
|
||||
if ($this->running) { // && $this->records_done == 0)
|
||||
$when_started = time() - $when_started;
|
||||
if ($when_started < $this->period) {
|
||||
for ($t = $this->period - $when_started; $this->running && $t > 0; $t --) { // DON'T do sleep($this->period - $when_started) because it prevents ticks !
|
||||
for ($t = $this->period - $when_started; $this->running && $t > 0; $t --) {
|
||||
// DON'T do sleep($this->period - $when_started) because it prevents ticks !
|
||||
$s = $this->getState();
|
||||
if ($s == self::STATE_TOSTOP) {
|
||||
$this->setState(self::STATE_STOPPED);
|
||||
$this->running = FALSE;
|
||||
} else {
|
||||
sleep(1);
|
||||
$this->sleep(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -570,8 +571,9 @@ abstract class task_abstract
|
||||
throw new \InvalidArgumentException(sprintf("(%s) is not > 0"));
|
||||
}
|
||||
|
||||
while ($this->running && $nsec -- > 0) {
|
||||
sleep(1);
|
||||
$end = microtime(true) + $nsec;
|
||||
while ($this->running && microtime(true) < $end) {
|
||||
usleep(10000);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user