Skip to content

Commit e018622

Browse files
committed
fix sleep.
if we use sleep in seconds , so clean up must be in seconds 2.
1 parent f920df0 commit e018622

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/CLI/Console.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,11 @@ static public function isInteractive(): bool
189189

190190
/**
191191
* @param callable $callback
192-
* @param int $sleep in seconds
192+
* @param int $sleep // seconds
193193
* @param callable $onError
194+
* @throws \Exception
194195
*/
195-
static public function loop(callable $callback, $sleep = 1 /* 1 second */, callable $onError = null): void
196+
static public function loop(callable $callback, int $sleep = 1 /* 1 second */, callable $onError = null): void
196197
{
197198
gc_enable();
198199

@@ -214,7 +215,7 @@ static public function loop(callable $callback, $sleep = 1 /* 1 second */, calla
214215
$time = $time + $sleep;
215216

216217
if (PHP_SAPI == "cli") {
217-
if($time >= (1000000 * 300)) { // Every 5 minutes
218+
if($time >= (5 * 60)) { // Every 5 minutes
218219
$time = 0;
219220
gc_collect_cycles(); //Forces collection of any existing garbage cycles
220221
}

0 commit comments

Comments
 (0)