# Changelog 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] - 2023-07-06 ### 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 - `\TamerLib\Classes > JobManager > connect()` re-constructs the Redis client before connecting to the server. ## [2.1.3] - 2023-07-27 ### Changed - `\TamerLib\Classes > JobManager > disconnect()` now disconnects even if the server is still connected, this is to prevent the server from being left in a bad state if the connection is lost. ## [2.1.2] - 2023-07-09 ### Changed - `\TamerLib\tm > wait()` no longer throws a TimeoutException, the function will simply return when the timeout is reached. ## [2.1.1] - 2023-07-07 ### Fixed - Fixed bug in JobManager in `\TamerLib\Classes > JobManager > returnJob()` and `\TamerLib\Classes > JobManager > returnException()` where if the "return_channel" is empty instead of null, the job would be returned to an empty channel instead of being dropped. ## [2.1.0] - 2023-07-07 ### Added - Implemented `ausleep()` in for `TamerLib\Classes\ > JobManager` to allow TamerLib to monitor sub-processes and workers without blocking the main thread. - Updated some methods in `TamerLib\Classes\ > JobManager` to use properties from `JobPacket` instead of calling the server for the same information if the passed parameter (usually $job_id) is an instance of `JobPacket`, this reduces the number of calls to the server and improves performance. - Updated some methods in `TamerLib > tm` to use `asleep` instead of `sleep` to allow TamerLib to monitor sub-processes and workers without blocking the main thread. - Added a custom redis configuration file to improve performance when running TamerLib on a single machine. ### Changed - `\TamerLib\Classes\ > RedisServer > start()` now starts the server with a matching logging level to `net.nosial.loglib` - Changed method `public static function do(string $function, array $arguments=[], int $channel=0): int` to `public static function do(string $function, array $arguments=[], ?callable $callback=null, array $options=[]): int` in `\TamerLib > tm > do()` so that the `$callback` parameter is now optional and will be used to handle the result of the job when `tm::wait()` is called, additionally some options can be passed to the job such as `channel` for passing on the channel to the function as previously done with the `$channel` parameter. - Changed method `public static function dof(string $function, array $arguments=[], int $channel=0): void` to `public static function dof(string $function, array $arguments=[], array $options=[]): void` in `\TamerLib > tm > dof()` to represent the changes made to `tm::do()` as described above. - Changed method `public static function wait(?callable $callback=null, int $timeout=0): void` to `public static function wait(int $timeout=0): void` as the function itself will now handle the result of the job using the callback passed to `tm::do()` or `tm::dof()` when the job is done. ### Fixed - Fixed synchronization issue in TamerLib where callbacks would run indefinitely if further jobs were added to the queue while the callback was running. ## [2.0.1] - 2023-06-30 Minor bugfixes and improvements. ### Fixed - Fixed bug where `\TamerLib > tm > run()` would return early even if the `$timeout` is set to 0. ### Changed - `\TamerLib > tm > do()` the parameter `$callback` is now optional. If not provided, the job result will not be handled by the client and just be discarded. ## [2.0.0] - 2023-06-18 This version of TamerLib offers a comprehensive framework for implementing parallel processing in PHP applications. With features aimed at scalability and robust handling of tasks and exceptions, it allows developers to build efficient, reliable applications. This makes previous versions of TamerLib obsolete, and as such, this version is not backwards compatible with previous versions. ### Added - Parallel Processing: Utilize the full power of your CPU by executing tasks concurrently using sub-processes or remote processes. - Task Queuing: Tasks are managed using a task queue and result queue, making it easy to keep track of tasks and their results. - Horizontal Scalability: TamerLib allows the creation of Tamer Nodes which act as supervisors for workers. Nodes and workers communicate with a central Redis Server, enabling applications to scale horizontally. - Exception Handling: Exception handling is built into TamerLib, allowing developers to catch and handle exceptions thrown by workers. - Introduced `tm::initialize`, `tm::createWorker` for client setup and worker creation respectively. - Added methods `tm::do` and `tm::wait` to manage job execution and completion tracking. - `tm::initialize`, `tm::addFunction` and `tm::run` have been added to help with setting up and managing workers. - Node implementation introduced, allowing supervision of workers and horizontal scaling of applications. - Workers can now throw exceptions which are caught and re-thrown on the client side. This allows for robust error handling across different parts of the application. ## [1.0.1] - 2022-02-28 ### Added - Added more logging calls for Gearman Client ## [1.0.0] - 2022-02-09 ### Added - Initial release