Compare commits
9 commits
Author | SHA1 | Date | |
---|---|---|---|
cf5837e005 | |||
518b23cd5f | |||
1631f89ae6 | |||
cc8612458d | |||
da8ed340ef | |||
0dd40dd600 | |||
696b8f16ff | |||
f0b7067107 | |||
eaa9887150 |
5 changed files with 63 additions and 22 deletions
|
@ -33,11 +33,15 @@ build:
|
|||
- if: $CI_COMMIT_BRANCH
|
||||
|
||||
release:
|
||||
stage: deploy
|
||||
script:
|
||||
- ncc build --config release --log-level debug
|
||||
artifacts:
|
||||
paths:
|
||||
- build/
|
||||
rules:
|
||||
- if: $CI_COMMIT_TAG
|
||||
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/
|
||||
rules:
|
||||
- if: $CI_COMMIT_TAG
|
||||
|
|
37
CHANGELOG.md
37
CHANGELOG.md
|
@ -5,6 +5,37 @@ 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
|
||||
|
@ -13,6 +44,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
being dropped.
|
||||
|
||||
|
||||
|
||||
## [2.1.0] - 2023-07-07
|
||||
|
||||
### Added
|
||||
|
@ -44,6 +76,7 @@ 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.
|
||||
|
@ -56,6 +89,7 @@ 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.
|
||||
|
@ -81,12 +115,15 @@ 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.1",
|
||||
"version": "2.1.5",
|
||||
"uuid": "a365e7d6-a1c0-11ed-b7c7-b9654ed9efa5"
|
||||
},
|
||||
"build": {
|
||||
|
|
|
@ -110,6 +110,8 @@
|
|||
|
||||
try
|
||||
{
|
||||
$this->redis_client = new Redis();
|
||||
|
||||
$this->redis_client->connect(
|
||||
$this->server_configuration->getHost(),
|
||||
$this->server_configuration->getPort()
|
||||
|
@ -141,16 +143,14 @@
|
|||
*/
|
||||
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
|
||||
{
|
||||
$this->redis_client->close();
|
||||
if($this->redis_client instanceof Redis)
|
||||
{
|
||||
$this->redis_client->close();
|
||||
}
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
|
|
|
@ -456,7 +456,6 @@
|
|||
* @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
|
||||
{
|
||||
|
@ -465,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));
|
||||
|
@ -492,7 +493,6 @@
|
|||
}
|
||||
|
||||
$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)
|
||||
{
|
||||
throw new TimeoutException('wait() timed out');
|
||||
return;
|
||||
}
|
||||
|
||||
if($timeout > 0 && (time() - $time_start) >= $timeout)
|
||||
{
|
||||
throw new TimeoutException('wait() timed out');
|
||||
return;
|
||||
}
|
||||
|
||||
usleep(1000);
|
||||
|
|
Loading…
Add table
Reference in a new issue