\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()

This commit is contained in:
Netkas 2023-08-06 16:16:13 -04:00
parent 1631f89ae6
commit 518b23cd5f
No known key found for this signature in database
GPG key ID: 5DAF58535614062B
3 changed files with 15 additions and 4 deletions

View file

@ -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

View file

@ -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": {

View file

@ -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));