Compare commits
No commits in common. "master" and "2.1.0" have entirely different histories.
5 changed files with 25 additions and 74 deletions
|
@ -36,10 +36,6 @@ release:
|
|||
stage: deploy
|
||||
script:
|
||||
- ncc build --config release --log-level debug
|
||||
- >
|
||||
curl --header "JOB-TOKEN: $CI_JOB_TOKEN"
|
||||
--upload-file build/release/net.nosial.focuscrawler.ncc
|
||||
"$CI_API_V4_URL/projects/$CI_PROJECT_ID/packages/generic/net.nosial.tamerlib/$CI_COMMIT_TAG/net.nosial.tamerlib.ncc"
|
||||
artifacts:
|
||||
paths:
|
||||
- build/
|
||||
|
|
47
CHANGELOG.md
47
CHANGELOG.md
|
@ -5,47 +5,7 @@ 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
|
||||
## [2.1.0] - 2023-07-7
|
||||
|
||||
### Added
|
||||
- Implemented `ausleep()` in for `TamerLib\Classes\ > JobManager` to allow TamerLib to monitor sub-processes and
|
||||
|
@ -76,7 +36,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
queue while the callback was running.
|
||||
|
||||
|
||||
|
||||
## [2.0.1] - 2023-06-30
|
||||
|
||||
Minor bugfixes and improvements.
|
||||
|
@ -89,7 +48,6 @@ Minor bugfixes and improvements.
|
|||
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.
|
||||
|
@ -115,15 +73,12 @@ versions.
|
|||
- 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
|
||||
|
|
|
@ -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.5",
|
||||
"version": "2.1.0",
|
||||
"uuid": "a365e7d6-a1c0-11ed-b7c7-b9654ed9efa5"
|
||||
},
|
||||
"build": {
|
||||
|
|
|
@ -110,8 +110,6 @@
|
|||
|
||||
try
|
||||
{
|
||||
$this->redis_client = new Redis();
|
||||
|
||||
$this->redis_client->connect(
|
||||
$this->server_configuration->getHost(),
|
||||
$this->server_configuration->getPort()
|
||||
|
@ -143,15 +141,17 @@
|
|||
*/
|
||||
public function disconnect(): void
|
||||
{
|
||||
if($this->isConnected())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Log::debug(Utilities::getName(), sprintf('JobManager disconnecting from %s:%s', $this->server_configuration->getHost(), $this->server_configuration->getPort()));
|
||||
|
||||
try
|
||||
{
|
||||
if($this->redis_client instanceof Redis)
|
||||
{
|
||||
$this->redis_client->close();
|
||||
}
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
Log::warning(Utilities::getName(),sprintf('JobManager could not disconnect safely from %s:%s', $this->server_configuration->getHost(), $this->server_configuration->getPort()), $e);
|
||||
|
@ -694,7 +694,7 @@
|
|||
}
|
||||
|
||||
/** @noinspection PhpUndefinedVariableInspection */
|
||||
if($return_channel === null || $return_channel === '')
|
||||
if($return_channel === null)
|
||||
{
|
||||
Log::debug(Utilities::getName(), sprintf('No return channel set, deleting job %s', $job_id));
|
||||
$this->getClient()->del($job_id);
|
||||
|
@ -755,7 +755,7 @@
|
|||
}
|
||||
|
||||
/** @noinspection PhpUndefinedVariableInspection */
|
||||
if($return_channel === null || $return_channel === '')
|
||||
if($return_channel === null)
|
||||
{
|
||||
Log::debug(Utilities::getName(), sprintf('No return channel set, deleting job %s', $job_id));
|
||||
$this->getClient()->del($job_id);
|
||||
|
|
|
@ -456,6 +456,7 @@
|
|||
* @throws JobManagerException If the JobManager throws an exception
|
||||
* @throws TamerException If the Tamer throws an exception
|
||||
* @throws Throwable If a job fails
|
||||
* @throws TimeoutException If the timeout is reached
|
||||
*/
|
||||
public static function wait(int $timeout=0): void
|
||||
{
|
||||
|
@ -464,27 +465,25 @@
|
|||
throw new RuntimeException(sprintf('Attempting to wait() in \'%s\' mode, only clients can preform wait().', self::$mode));
|
||||
}
|
||||
|
||||
self::monitor(-1);
|
||||
|
||||
$time_start = time();
|
||||
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));
|
||||
|
@ -493,6 +492,7 @@
|
|||
}
|
||||
|
||||
$job_packet = self::$job_manager->getJob($job_id);
|
||||
|
||||
if(isset(self::$job_callbacks[$job_id]))
|
||||
{
|
||||
$callback = self::$job_callbacks[$job_id];
|
||||
|
@ -548,12 +548,12 @@
|
|||
|
||||
if ($timeout < 0)
|
||||
{
|
||||
return;
|
||||
throw new TimeoutException('wait() timed out');
|
||||
}
|
||||
|
||||
if($timeout > 0 && (time() - $time_start) >= $timeout)
|
||||
{
|
||||
return;
|
||||
throw new TimeoutException('wait() timed out');
|
||||
}
|
||||
|
||||
usleep(1000);
|
||||
|
|
Loading…
Add table
Reference in a new issue