From 6456ab92190300760c7c7a424cbe58c52c9533c0 Mon Sep 17 00:00:00 2001 From: Ronan Giron Date: Tue, 26 Nov 2024 22:51:37 +0100 Subject: [PATCH] Remove sleep before exit Fix TypeError with float to usleep() method --- CHANGELOG.md | 10 ++++++++++ src/Worker.php | 4 +--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 80af5b1..275d9ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/Worker.php b/src/Worker.php index c176713..0bfa7fe 100644 --- a/src/Worker.php +++ b/src/Worker.php @@ -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(); @@ -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(); }