feat(legacy): replace massivescale/celery-php with jooola/celery-php

This commit is contained in:
jo 2022-03-04 18:46:57 +01:00 committed by Kyle Robbertze
parent f5bb31e971
commit dc7560e1df
3 changed files with 161 additions and 134 deletions

View File

@ -1,5 +1,9 @@
<?php
use Celery\Celery;
use Celery\CeleryException;
use Celery\CeleryTimeoutException;
class CeleryManager
{
/**
@ -38,12 +42,11 @@ class CeleryManager
$config['rabbitmq']['user'],
$config['rabbitmq']['password'],
$config['rabbitmq']['vhost'],
$exchange, // Exchange name
$queue, // Binding/queue
$config['rabbitmq']['port'],
$exchange,
$queue,
$config['rabbitmq']['port'],
false,
true, // Persistent messages
self::$_CELERY_MESSAGE_TIMEOUT
self::$_CELERY_MESSAGE_TIMEOUT
); // Result expiration
}
@ -93,13 +96,11 @@ class CeleryManager
// track reference here in case it was a deletion that failed, for example.
$task->setDbStatus(CELERY_FAILED_STATUS)->save();
throw new CeleryTimeoutException('Celery task ' . $task->getDbName()
. ' with ID ' . $task->getDbTaskId() . ' timed out');
throw new CeleryTimeoutException('Celery task ' . $task->getDbName() . ' with ID ' . $task->getDbTaskId() . ' timed out');
}
// The message hasn't timed out, but it's still false, which means it hasn't been
// sent back from Celery yet.
throw new CeleryException('Waiting on Celery task ' . $task->getDbName()
. ' with ID ' . $task->getDbTaskId());
throw new CeleryException('Waiting on Celery task ' . $task->getDbName() . ' with ID ' . $task->getDbTaskId());
}
return $message;
@ -132,8 +133,9 @@ class CeleryManager
*/
public static function pollBrokerTaskQueue($taskName = '', $serviceName = '')
{
$pendingTasks = empty(self::$_pendingTasks) ? static::_getPendingTasks($taskName, $serviceName)
: self::$_pendingTasks;
$pendingTasks = empty(self::$_pendingTasks)
? static::_getPendingTasks($taskName, $serviceName)
: self::$_pendingTasks;
foreach ($pendingTasks as $task) {
try {
$message = static::_getTaskMessage($task);

View File

@ -14,13 +14,17 @@
{
"type": "vcs",
"url": "https://github.com/jooola/propel1"
},
{
"type": "vcs",
"url": "https://github.com/jooola/celery-php"
}
],
"require": {
"composer/semver": "^3.2",
"james-heinrich/getid3": "^1.9",
"jooola/celery-php": "dev-master",
"jooola/propel1": "dev-master",
"massivescale/celery-php": "^2.1",
"php-amqplib/php-amqplib": "^3.0",
"simplepie/simplepie": "^1.5",
"zf1s/zend-acl": "^1.13",

265
legacy/composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "859db0c19832f3e981bccb7870b7a330",
"content-hash": "6ff6e427d89556d1633e2b49764de2c4",
"packages": [
{
"name": "composer/semver",
@ -154,6 +154,80 @@
},
"time": "2021-09-22T16:34:51+00:00"
},
{
"name": "jooola/celery-php",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/jooola/celery-php.git",
"reference": "395c556159d0c143ffc12cb78f7ba405252dc748"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/jooola/celery-php/zipball/395c556159d0c143ffc12cb78f7ba405252dc748",
"reference": "395c556159d0c143ffc12cb78f7ba405252dc748",
"shasum": ""
},
"require": {
"php": ">=7.0"
},
"require-dev": {
"ext-amqp": "*",
"php-amqplib/php-amqplib": ">=3.0",
"phpunit/phpunit": "<6.0.0",
"predis/predis": "*"
},
"suggest": {
"ext-amqp": "Adds support for the AMQP extension for PHP backend",
"php-amqplib/php-amqplib": "Adds support for the php-amqplib, AMQP library for PHP, backend",
"predis/predis": "Adds support for the predis, PHP client library for Redis, backend"
},
"default-branch": true,
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
}
},
"autoload": {
"psr-4": {
"Celery\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Celery\\Tests\\": "tests/"
}
},
"license": [
"BSD-2-Clause"
],
"authors": [
{
"name": "GDR!",
"email": "info@massivescale.net",
"homepage": "http://massivescale.net/",
"role": "Developer"
}
],
"description": "PHP client for Celery task queue",
"homepage": "https://github.com/gjedeer/celery-php/",
"keywords": [
"amqp",
"celery",
"cron",
"python",
"queue",
"redis",
"task"
],
"support": {
"issues": "https://github.com/gjedeer/celery-php/issues",
"docs": "https://github.com/gjedeer/celery-php/",
"source": "https://github.com/jooola/celery-php/tree/master"
},
"time": "2022-01-10T15:49:18+00:00"
},
{
"name": "jooola/propel1",
"version": "dev-master",
@ -231,65 +305,6 @@
},
"time": "2022-01-13T02:39:05+00:00"
},
{
"name": "massivescale/celery-php",
"version": "2.1.2",
"source": {
"type": "git",
"url": "https://github.com/gjedeer/celery-php.git",
"reference": "4725dffec3ba03835191ea9d05bbd2777d4bc46f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/gjedeer/celery-php/zipball/4725dffec3ba03835191ea9d05bbd2777d4bc46f",
"reference": "4725dffec3ba03835191ea9d05bbd2777d4bc46f",
"shasum": ""
},
"suggest": {
"predis/predis": "Adds support for the predis, PHP client library for Redis, backend",
"videlalvaro/php-amqplib": "Adds support for the php-amqplib, AMQP library for PHP, backend"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.2-dev"
}
},
"autoload": {
"classmap": [
"celery.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-2-Clause"
],
"authors": [
{
"name": "GDR!",
"email": "info@massivescale.net",
"homepage": "http://massivescale.net/",
"role": "Developer"
}
],
"description": "PHP client for Celery task queue",
"homepage": "https://github.com/gjedeer/celery-php/",
"keywords": [
"AMQP",
"celery",
"cron",
"python",
"queue",
"redis",
"task"
],
"support": {
"docs": "https://github.com/gjedeer/celery-php/",
"issues": "https://github.com/gjedeer/celery-php/issues",
"source": "https://github.com/gjedeer/celery-php/tree/master"
},
"time": "2016-10-16T07:17:19+00:00"
},
{
"name": "paragonie/constant_time_encoding",
"version": "v2.5.0",
@ -409,16 +424,16 @@
},
{
"name": "phing/phing",
"version": "2.17.0",
"version": "2.17.2",
"source": {
"type": "git",
"url": "https://github.com/phingofficial/phing.git",
"reference": "c0a3bce822c088d60b30a577c25debb42325d0f8"
"reference": "8b8cee3eb12c24502fc4c227ac5889746248a140"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phingofficial/phing/zipball/c0a3bce822c088d60b30a577c25debb42325d0f8",
"reference": "c0a3bce822c088d60b30a577c25debb42325d0f8",
"url": "https://api.github.com/repos/phingofficial/phing/zipball/8b8cee3eb12c24502fc4c227ac5889746248a140",
"reference": "8b8cee3eb12c24502fc4c227ac5889746248a140",
"shasum": ""
},
"require": {
@ -501,7 +516,7 @@
"support": {
"irc": "irc://irc.freenode.net/phing",
"issues": "https://www.phing.info/trac/report",
"source": "https://github.com/phingofficial/phing/tree/2.17.0"
"source": "https://github.com/phingofficial/phing/tree/2.17.2"
},
"funding": [
{
@ -517,7 +532,7 @@
"type": "patreon"
}
],
"time": "2021-08-31T13:33:01+00:00"
"time": "2022-02-09T09:50:58+00:00"
},
{
"name": "php-amqplib/php-amqplib",
@ -602,16 +617,16 @@
},
{
"name": "phpseclib/phpseclib",
"version": "3.0.12",
"version": "3.0.13",
"source": {
"type": "git",
"url": "https://github.com/phpseclib/phpseclib.git",
"reference": "89bfb45bd8b1abc3b37e910d57f5dbd3174f40fb"
"reference": "1443ab79364eea48665fa8c09ac67f37d1025f7e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/89bfb45bd8b1abc3b37e910d57f5dbd3174f40fb",
"reference": "89bfb45bd8b1abc3b37e910d57f5dbd3174f40fb",
"url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/1443ab79364eea48665fa8c09ac67f37d1025f7e",
"reference": "1443ab79364eea48665fa8c09ac67f37d1025f7e",
"shasum": ""
},
"require": {
@ -693,7 +708,7 @@
],
"support": {
"issues": "https://github.com/phpseclib/phpseclib/issues",
"source": "https://github.com/phpseclib/phpseclib/tree/3.0.12"
"source": "https://github.com/phpseclib/phpseclib/tree/3.0.13"
},
"funding": [
{
@ -709,7 +724,7 @@
"type": "tidelift"
}
],
"time": "2021-11-28T23:46:03+00:00"
"time": "2022-01-30T08:50:05+00:00"
},
{
"name": "simplepie/simplepie",
@ -2467,29 +2482,30 @@
"packages-dev": [
{
"name": "doctrine/instantiator",
"version": "1.4.0",
"version": "1.4.1",
"source": {
"type": "git",
"url": "https://github.com/doctrine/instantiator.git",
"reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b"
"reference": "10dcfce151b967d20fde1b34ae6640712c3891bc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/instantiator/zipball/d56bf6102915de5702778fe20f2de3b2fe570b5b",
"reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b",
"url": "https://api.github.com/repos/doctrine/instantiator/zipball/10dcfce151b967d20fde1b34ae6640712c3891bc",
"reference": "10dcfce151b967d20fde1b34ae6640712c3891bc",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0"
},
"require-dev": {
"doctrine/coding-standard": "^8.0",
"doctrine/coding-standard": "^9",
"ext-pdo": "*",
"ext-phar": "*",
"phpbench/phpbench": "^0.13 || 1.0.0-alpha2",
"phpstan/phpstan": "^0.12",
"phpstan/phpstan-phpunit": "^0.12",
"phpunit/phpunit": "^7.0 || ^8.0 || ^9.0"
"phpbench/phpbench": "^0.16 || ^1",
"phpstan/phpstan": "^1.4",
"phpstan/phpstan-phpunit": "^1",
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.5",
"vimeo/psalm": "^4.22"
},
"type": "library",
"autoload": {
@ -2516,7 +2532,7 @@
],
"support": {
"issues": "https://github.com/doctrine/instantiator/issues",
"source": "https://github.com/doctrine/instantiator/tree/1.4.0"
"source": "https://github.com/doctrine/instantiator/tree/1.4.1"
},
"funding": [
{
@ -2532,41 +2548,42 @@
"type": "tidelift"
}
],
"time": "2020-11-10T18:47:58+00:00"
"time": "2022-03-03T08:28:38+00:00"
},
{
"name": "myclabs/deep-copy",
"version": "1.10.2",
"version": "1.11.0",
"source": {
"type": "git",
"url": "https://github.com/myclabs/DeepCopy.git",
"reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220"
"reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/776f831124e9c62e1a2c601ecc52e776d8bb7220",
"reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220",
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614",
"reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0"
},
"replace": {
"myclabs/deep-copy": "self.version"
"conflict": {
"doctrine/collections": "<1.6.8",
"doctrine/common": "<2.13.3 || >=3,<3.2.2"
},
"require-dev": {
"doctrine/collections": "^1.0",
"doctrine/common": "^2.6",
"phpunit/phpunit": "^7.1"
"doctrine/collections": "^1.6.8",
"doctrine/common": "^2.13.3 || ^3.2.2",
"phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13"
},
"type": "library",
"autoload": {
"psr-4": {
"DeepCopy\\": "src/DeepCopy/"
},
"files": [
"src/DeepCopy/deep_copy.php"
]
],
"psr-4": {
"DeepCopy\\": "src/DeepCopy/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@ -2582,7 +2599,7 @@
],
"support": {
"issues": "https://github.com/myclabs/DeepCopy/issues",
"source": "https://github.com/myclabs/DeepCopy/tree/1.10.2"
"source": "https://github.com/myclabs/DeepCopy/tree/1.11.0"
},
"funding": [
{
@ -2590,7 +2607,7 @@
"type": "tidelift"
}
],
"time": "2020-11-13T09:40:50+00:00"
"time": "2022-03-03T13:19:32+00:00"
},
{
"name": "phpdocumentor/reflection-common",
@ -2647,16 +2664,16 @@
},
{
"name": "phpdocumentor/reflection-docblock",
"version": "5.2.2",
"version": "5.3.0",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
"reference": "069a785b2141f5bcf49f3e353548dc1cce6df556"
"reference": "622548b623e81ca6d78b721c5e029f4ce664f170"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/069a785b2141f5bcf49f3e353548dc1cce6df556",
"reference": "069a785b2141f5bcf49f3e353548dc1cce6df556",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170",
"reference": "622548b623e81ca6d78b721c5e029f4ce664f170",
"shasum": ""
},
"require": {
@ -2667,7 +2684,8 @@
"webmozart/assert": "^1.9.1"
},
"require-dev": {
"mockery/mockery": "~1.3.2"
"mockery/mockery": "~1.3.2",
"psalm/phar": "^4.8"
},
"type": "library",
"extra": {
@ -2697,22 +2715,22 @@
"description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
"support": {
"issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues",
"source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/master"
"source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.3.0"
},
"time": "2020-09-03T19:13:55+00:00"
"time": "2021-10-19T17:43:47+00:00"
},
{
"name": "phpdocumentor/type-resolver",
"version": "1.5.1",
"version": "1.6.0",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/TypeResolver.git",
"reference": "a12f7e301eb7258bb68acd89d4aefa05c2906cae"
"reference": "93ebd0014cab80c4ea9f5e297ea48672f1b87706"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/a12f7e301eb7258bb68acd89d4aefa05c2906cae",
"reference": "a12f7e301eb7258bb68acd89d4aefa05c2906cae",
"url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/93ebd0014cab80c4ea9f5e297ea48672f1b87706",
"reference": "93ebd0014cab80c4ea9f5e297ea48672f1b87706",
"shasum": ""
},
"require": {
@ -2747,9 +2765,9 @@
"description": "A PSR-5 based resolver of Class names, Types and Structural Element Names",
"support": {
"issues": "https://github.com/phpDocumentor/TypeResolver/issues",
"source": "https://github.com/phpDocumentor/TypeResolver/tree/1.5.1"
"source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.0"
},
"time": "2021-10-02T14:08:47+00:00"
"time": "2022-01-04T19:58:01+00:00"
},
{
"name": "phpspec/prophecy",
@ -3812,7 +3830,6 @@
"issues": "https://github.com/sebastianbergmann/resource-operations/issues",
"source": "https://github.com/sebastianbergmann/resource-operations/tree/master"
},
"abandoned": true,
"time": "2015-07-28T20:34:47+00:00"
},
{
@ -3864,21 +3881,24 @@
},
{
"name": "symfony/polyfill-ctype",
"version": "v1.23.0",
"version": "v1.25.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce"
"reference": "30885182c981ab175d4d034db0f6f469898070ab"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce",
"reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/30885182c981ab175d4d034db0f6f469898070ab",
"reference": "30885182c981ab175d4d034db0f6f469898070ab",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
"provide": {
"ext-ctype": "*"
},
"suggest": {
"ext-ctype": "For best performance"
},
@ -3893,12 +3913,12 @@
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Ctype\\": ""
},
"files": [
"bootstrap.php"
]
],
"psr-4": {
"Symfony\\Polyfill\\Ctype\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@ -3923,7 +3943,7 @@
"portable"
],
"support": {
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.23.0"
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.25.0"
},
"funding": [
{
@ -3939,7 +3959,7 @@
"type": "tidelift"
}
],
"time": "2021-02-19T12:13:01+00:00"
"time": "2021-10-20T20:35:02+00:00"
},
{
"name": "symfony/yaml",
@ -4182,6 +4202,7 @@
"aliases": [],
"minimum-stability": "stable",
"stability-flags": {
"jooola/celery-php": 20,
"jooola/propel1": 20
},
"prefer-stable": false,