Skip to content

Commit

Permalink
Remove sleep before exit
Browse files Browse the repository at this point in the history
Fix TypeError with float to usleep() method
  • Loading branch information
ElGigi committed Nov 26, 2024
1 parent eff46bd commit 6456ab9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [1.0.0-beta3] - 2024-11-26

### Deleted

- Remove sleep before exit

### Fixed

- TypeError with float to usleep() method

## [1.0.0-beta2] - 2024-11-22

### Changed
Expand Down
4 changes: 1 addition & 3 deletions src/Worker.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public function run(QueueInterface $queue, WorkerOptions $options = new WorkerOp

do {
// Sleep between get new job
$nbJobsExecuted > 0 && usleep($options->sleep * 1000 * 1000);
$nbJobsExecuted > 0 && usleep((int)($options->sleep * 1000 * 1000));

// Get a job to consume
$job = $queue->consume();
Expand Down Expand Up @@ -219,8 +219,6 @@ public function run(QueueInterface $queue, WorkerOptions $options = new WorkerOp

$this->logger?->info(sprintf('Exit(%d): %s', $exit->code(), $exit->reason()));

sleep(1);

return $exit->code();
}

Expand Down

0 comments on commit 6456ab9

Please sign in to comment.