diff --git a/CHANGELOG.md b/CHANGELOG.md index d02ecb0..8e223b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [2.1.5] - Unreleased + +### Fixed + - `\TamerLib\tm > wait()` will output worker updates even if there are no jobs in the queue, this fixes a bug where + workers would not be updated if the client only calls `dof()` + + + ## [2.1.4] - 2023-07-28 ### Fixed diff --git a/project.json b/project.json index 734e467..65857ce 100644 --- a/project.json +++ b/project.json @@ -22,7 +22,7 @@ "description": "TamerLib allows the execution of parallel tasks", "company": "Nosial", "copyright": "Copyright (c) 2022-2023 Nosial, All Rights Reserved", - "version": "2.1.4", + "version": "2.1.5", "uuid": "a365e7d6-a1c0-11ed-b7c7-b9654ed9efa5" }, "build": { diff --git a/src/TamerLib/tm.php b/src/TamerLib/tm.php index c65d6c1..1a9ff90 100644 --- a/src/TamerLib/tm.php +++ b/src/TamerLib/tm.php @@ -464,25 +464,27 @@ throw new RuntimeException(sprintf('Attempting to wait() in \'%s\' mode, only clients can preform wait().', self::$mode)); } - $time_start = time(); + self::monitor(-1); + if(count(self::$watching_jobs) === 0) { return; } + $time_start = time(); $watching_jobs = self::$watching_jobs; Log::verbose(Utilities::getName(), sprintf('Waiting for %s job(s) to complete', count($watching_jobs))); while(true) { + self::monitor(-1); + if(count($watching_jobs) === 0) { return; } - self::monitor(-1); $job_id = self::$job_manager->listenReturnChannel(self::$return_channel); - if(!in_array($job_id, $watching_jobs, false)) { Log::debug(Utilities::getName(), sprintf('Job \'%s\' has returned, but is not in the watchlist', $job_id));