Compare commits
No commits in common. "master" and "2.1.1" have entirely different histories.
5 changed files with 22 additions and 63 deletions
|
@ -33,15 +33,11 @@ build:
|
||||||
- if: $CI_COMMIT_BRANCH
|
- if: $CI_COMMIT_BRANCH
|
||||||
|
|
||||||
release:
|
release:
|
||||||
stage: deploy
|
stage: deploy
|
||||||
script:
|
script:
|
||||||
- ncc build --config release --log-level debug
|
- ncc build --config release --log-level debug
|
||||||
- >
|
artifacts:
|
||||||
curl --header "JOB-TOKEN: $CI_JOB_TOKEN"
|
paths:
|
||||||
--upload-file build/release/net.nosial.focuscrawler.ncc
|
- build/
|
||||||
"$CI_API_V4_URL/projects/$CI_PROJECT_ID/packages/generic/net.nosial.tamerlib/$CI_COMMIT_TAG/net.nosial.tamerlib.ncc"
|
rules:
|
||||||
artifacts:
|
- if: $CI_COMMIT_TAG
|
||||||
paths:
|
|
||||||
- build/
|
|
||||||
rules:
|
|
||||||
- if: $CI_COMMIT_TAG
|
|
37
CHANGELOG.md
37
CHANGELOG.md
|
@ -5,37 +5,6 @@ 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/),
|
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).
|
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
|
## [2.1.1] - 2023-07-07
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
@ -44,7 +13,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
being dropped.
|
being dropped.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## [2.1.0] - 2023-07-07
|
## [2.1.0] - 2023-07-07
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
@ -76,7 +44,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
queue while the callback was running.
|
queue while the callback was running.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## [2.0.1] - 2023-06-30
|
## [2.0.1] - 2023-06-30
|
||||||
|
|
||||||
Minor bugfixes and improvements.
|
Minor bugfixes and improvements.
|
||||||
|
@ -89,7 +56,6 @@ Minor bugfixes and improvements.
|
||||||
handled by the client and just be discarded.
|
handled by the client and just be discarded.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## [2.0.0] - 2023-06-18
|
## [2.0.0] - 2023-06-18
|
||||||
|
|
||||||
This version of TamerLib offers a comprehensive framework for implementing parallel processing in PHP applications.
|
This version of TamerLib offers a comprehensive framework for implementing parallel processing in PHP applications.
|
||||||
|
@ -115,15 +81,12 @@ versions.
|
||||||
- Workers can now throw exceptions which are caught and re-thrown on the client side.
|
- 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.
|
This allows for robust error handling across different parts of the application.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## [1.0.1] - 2022-02-28
|
## [1.0.1] - 2022-02-28
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
- Added more logging calls for Gearman Client
|
- Added more logging calls for Gearman Client
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## [1.0.0] - 2022-02-09
|
## [1.0.0] - 2022-02-09
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
"description": "TamerLib allows the execution of parallel tasks",
|
"description": "TamerLib allows the execution of parallel tasks",
|
||||||
"company": "Nosial",
|
"company": "Nosial",
|
||||||
"copyright": "Copyright (c) 2022-2023 Nosial, All Rights Reserved",
|
"copyright": "Copyright (c) 2022-2023 Nosial, All Rights Reserved",
|
||||||
"version": "2.1.5",
|
"version": "2.1.1",
|
||||||
"uuid": "a365e7d6-a1c0-11ed-b7c7-b9654ed9efa5"
|
"uuid": "a365e7d6-a1c0-11ed-b7c7-b9654ed9efa5"
|
||||||
},
|
},
|
||||||
"build": {
|
"build": {
|
||||||
|
|
|
@ -110,8 +110,6 @@
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$this->redis_client = new Redis();
|
|
||||||
|
|
||||||
$this->redis_client->connect(
|
$this->redis_client->connect(
|
||||||
$this->server_configuration->getHost(),
|
$this->server_configuration->getHost(),
|
||||||
$this->server_configuration->getPort()
|
$this->server_configuration->getPort()
|
||||||
|
@ -143,14 +141,16 @@
|
||||||
*/
|
*/
|
||||||
public function disconnect(): void
|
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()));
|
Log::debug(Utilities::getName(), sprintf('JobManager disconnecting from %s:%s', $this->server_configuration->getHost(), $this->server_configuration->getPort()));
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if($this->redis_client instanceof Redis)
|
$this->redis_client->close();
|
||||||
{
|
|
||||||
$this->redis_client->close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch(Exception $e)
|
catch(Exception $e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -456,6 +456,7 @@
|
||||||
* @throws JobManagerException If the JobManager throws an exception
|
* @throws JobManagerException If the JobManager throws an exception
|
||||||
* @throws TamerException If the Tamer throws an exception
|
* @throws TamerException If the Tamer throws an exception
|
||||||
* @throws Throwable If a job fails
|
* @throws Throwable If a job fails
|
||||||
|
* @throws TimeoutException If the timeout is reached
|
||||||
*/
|
*/
|
||||||
public static function wait(int $timeout=0): void
|
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));
|
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)
|
if(count(self::$watching_jobs) === 0)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$time_start = time();
|
|
||||||
$watching_jobs = self::$watching_jobs;
|
$watching_jobs = self::$watching_jobs;
|
||||||
Log::verbose(Utilities::getName(), sprintf('Waiting for %s job(s) to complete', count($watching_jobs)));
|
Log::verbose(Utilities::getName(), sprintf('Waiting for %s job(s) to complete', count($watching_jobs)));
|
||||||
|
|
||||||
while(true)
|
while(true)
|
||||||
{
|
{
|
||||||
self::monitor(-1);
|
|
||||||
|
|
||||||
if(count($watching_jobs) === 0)
|
if(count($watching_jobs) === 0)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self::monitor(-1);
|
||||||
$job_id = self::$job_manager->listenReturnChannel(self::$return_channel);
|
$job_id = self::$job_manager->listenReturnChannel(self::$return_channel);
|
||||||
|
|
||||||
if(!in_array($job_id, $watching_jobs, false))
|
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));
|
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);
|
$job_packet = self::$job_manager->getJob($job_id);
|
||||||
|
|
||||||
if(isset(self::$job_callbacks[$job_id]))
|
if(isset(self::$job_callbacks[$job_id]))
|
||||||
{
|
{
|
||||||
$callback = self::$job_callbacks[$job_id];
|
$callback = self::$job_callbacks[$job_id];
|
||||||
|
@ -548,12 +548,12 @@
|
||||||
|
|
||||||
if ($timeout < 0)
|
if ($timeout < 0)
|
||||||
{
|
{
|
||||||
return;
|
throw new TimeoutException('wait() timed out');
|
||||||
}
|
}
|
||||||
|
|
||||||
if($timeout > 0 && (time() - $time_start) >= $timeout)
|
if($timeout > 0 && (time() - $time_start) >= $timeout)
|
||||||
{
|
{
|
||||||
return;
|
throw new TimeoutException('wait() timed out');
|
||||||
}
|
}
|
||||||
|
|
||||||
usleep(1000);
|
usleep(1000);
|
||||||
|
|
Loading…
Add table
Reference in a new issue