Skip to content

Commit 74fa7f3

Browse files
authored
Merge pull request #530 from s1lver/update_branch30
2 parents 032da07 + 5cfd615 commit 74fa7f3

53 files changed

Lines changed: 1208 additions & 60 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
strategy:
3131
fail-fast: false
3232
matrix:
33-
php: [ '8.1', '8.2' ]
33+
php: [ '8.2', '8.3' ]
3434
steps:
3535
- name: Checkout.
3636
uses: actions/checkout@v2

.github/workflows/static.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
strategy:
3333
fail-fast: false
3434
matrix:
35-
php: [ '8.1', '8.2' ]
35+
php: [ '8.2', '8.3', '8.4' ]
3636
steps:
3737
- name: Checkout.
3838
uses: actions/checkout@v2

CHANGELOG.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
Yii2 Queue Extension Change Log
22
===============================
33

4-
2.3.7 under development
4+
2.3.8 under development
55
-----------------------
6+
- Enh #516: Ensure Redis driver messages are consumed at least once (soul11201)
7+
- Bug #522: Fix SQS driver type error with custom value passed to `queue/listen` (flaviovs)
68

7-
- no changes in this release.
9+
10+
2.3.7 April 29, 2024
11+
--------------------
12+
13+
- Enh #509: Add StatisticsProviderInterface to get statistics from queue (kalmer)
814

915

1016
2.3.6 October 03, 2023

Makefile

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
11
help: ## Display help information
22
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'
33

4-
build: ## Build an image from a docker-compose file. Params: {{ v=8.1 }}. Default latest PHP 8.1
4+
build: ## Build an image from a docker-compose file. Params: {{ v=8.2 }}. Default latest PHP 8.2
55
@cp -n .env.example .env
6-
PHP_VERSION=$(filter-out $@,$(v)) docker-compose up -d --build
6+
PHP_VERSION=$(filter-out $@,$(v)) docker compose up -d --build
77
make create-sqs-queue
88
make create-sqs-fifo-queue
99

10-
test: ## Run tests. Params: {{ v=8.1 }}. Default latest PHP 8.1
10+
test: ## Run tests. Params: {{ v=8.2 }}. Default latest PHP 8.2
1111
make build
12-
PHP_VERSION=$(filter-out $@,$(v)) docker-compose run yii2-queue-php vendor/bin/phpunit --coverage-clover coverage.xml
12+
PHP_VERSION=$(filter-out $@,$(v)) docker compose run yii2-queue-php vendor/bin/phpunit --coverage-clover coverage.xml
1313
make down
1414

1515
down: ## Stop and remove containers, networks
16-
docker-compose down
16+
docker compose down
1717

18-
benchmark: ## Run benchmark. Params: {{ v=8.1 }}. Default latest PHP 8.1
19-
PHP_VERSION=$(filter-out $@,$(v)) docker-compose build --pull yii2-queue-php
20-
PHP_VERSION=$(filter-out $@,$(v)) docker-compose run yii2-queue-php tests/yii benchmark/waiting
18+
benchmark: ## Run benchmark. Params: {{ v=8.2 }}. Default latest PHP 8.2
19+
PHP_VERSION=$(filter-out $@,$(v)) docker compose build --pull yii2-queue-php
20+
PHP_VERSION=$(filter-out $@,$(v)) docker compose run yii2-queue-php tests/yii benchmark/waiting
2121
make down
2222

2323
sh: ## Enter the container with the application
2424
docker exec -it yii2-queue-php sh
2525

26-
static-analyze: ## Run code static analyze. Params: {{ v=8.1 }}. Default latest PHP 8.1
27-
PHP_VERSION=$(filter-out $@,$(v)) docker-compose build --pull yii2-queue-php
28-
PHP_VERSION=$(filter-out $@,$(v)) docker-compose run yii2-queue-php vendor/bin/psalm --config=psalm.xml --shepherd --stats --php-version=$(v)
26+
static-analyze: ## Run code static analyze. Params: {{ v=8.2 }}. Default latest PHP 8.2
27+
PHP_VERSION=$(filter-out $@,$(v)) docker compose build --pull yii2-queue-php
28+
PHP_VERSION=$(filter-out $@,$(v)) docker compose run yii2-queue-php vendor/bin/psalm --config=psalm.xml --shepherd --stats --php-version=$(v)
2929
make down
3030

3131
clean:
32-
docker-compose down
32+
docker compose down
3333
rm -rf tests/runtime/*
3434
rm -f .php_cs.cache
3535
rm -rf composer.lock

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Documentation is at [docs/guide/README.md](docs/guide/README.md).
1818

1919
## Requirements
2020

21-
- PHP 8.1 or higher.
21+
- PHP 8.2 or higher.
2222

2323
Installation
2424
------------

composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "yiisoft/yii2-queue",
3-
"description": "Yii2 Queue Extension which supported DB, Redis, RabbitMQ, Beanstalk, SQS and Gearman",
3+
"description": "Yii2 Queue Extension which supports queues based on DB, Redis, RabbitMQ, Beanstalk, SQS, and Gearman",
44
"type": "yii2-extension",
55
"keywords": ["yii", "queue", "async", "gii", "db", "redis", "rabbitmq", "beanstalk", "gearman", "sqs"],
66
"license": "BSD-3-Clause",
@@ -16,9 +16,9 @@
1616
"docs": "https://github.com/yiisoft/yii2-queue/blob/master/docs/guide"
1717
},
1818
"require": {
19-
"php": ">=8.1",
20-
"yiisoft/yii2": "~2.0.14",
21-
"symfony/process": "^6.3",
19+
"php": ">=8.2",
20+
"yiisoft/yii2": "~2.0.50",
21+
"symfony/process": "^7.0",
2222
"laravel/serializable-closure": "^v1.3.0"
2323
},
2424
"require-dev": {
@@ -33,7 +33,7 @@
3333
"enqueue/stomp": "^0.10.0",
3434
"pda/pheanstalk": "^5.0.0",
3535
"aws/aws-sdk-php": "3.285.0",
36-
"vimeo/psalm": "^5.10.0"
36+
"vimeo/psalm": "^6.0.0"
3737
},
3838
"suggest": {
3939
"ext-pcntl": "Need for process signals.",

docs/guide-zh-CN/retryable.md

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
错误与重复执行
22
=========================
33

4-
在作业处理期间可以抛出异常。 当请求的服务和外部资源不可用时,由于代码编写的比较糟糕而导致的内部错误
5-
在第二种情况下,可以在一段时间后重新尝试这个作业
4+
作业的执行可能会失败。这可能是由于内部错误造成的,这些错误是由编写不当的代码导致的,应该首先修复。但是,它们也可能由于外部问题(例如服务或资源不可用)而失败。这可能会导致异常或超时
5+
在后一种情况下,最好能够在一段时间后重试作业。有几种方法可以做到这一点
66

7-
有几种方法可以做到这一点
7+
>注意:下面描述的 ttr 功能需要安装 [PHP Process Control (pcntl)](https://www.php.net/manual/en/book.pcntl.php) 扩展,并且 worker 命令必须使用 --isolate 选项(默认启用)
88
99
重试选项
1010
-------------
@@ -21,7 +21,12 @@
2121
],
2222
```
2323

24-
`ttr` 选项设置了在队列中保留工作的时间。如果一份作业在这段时间没有执行,它将返回队列进行重试。
24+
`ttr` 选项设置了作业必须成功完成的秒数。因此,可能会发生两件事来使工作失败:
25+
1. 作业在`ttr`结束之前发生异常
26+
2. 完成作业所需的时间将比 ttr 长(超时),工作线程停止作业执行
27+
28+
在这两种情况下,作业都将发送回队列进行重试。但请注意,在第一种情况下,即使作业在运行后立即停止,也不会立即重试,要等到`ttr`"用完"。也就是说,在将作业发送回队列之前,必须经过剩余的 ttr 秒数。
29+
2530
`attempts` 选项设置了最大的尝试次数。如果尝试已经结束,作业作还没有完成,它将从队列中移除。
2631

2732
这种将全局设置队列中的所有作业,如果您需要为多个作业进行不同的设置可以使用,
@@ -30,7 +35,7 @@
3035
重试作业接口
3136
----------------------
3237

33-
Separate control of retry is implemented by `RetryableJobInterface` 接口。 示例:
38+
为了更好地控制重试逻辑,作业可以实现 `RetryableJobInterface` 接口。 示例:
3439

3540
```php
3641
class SomeJob extends BaseObject implements RetryableJobInterface
@@ -85,14 +90,14 @@ Yii::$app->queue->on(Queue::EVENT_AFTER_ERROR, function (ExecEvent $event) {
8590
限制
8691
------------
8792

88-
完全支持 [Beanstalk], [DB], [File][Redis] 驱动程序的重试工具
89-
[Sync] 驱动不会重试失败的工作 [Gearman] 不支持重试
90-
[RabbitMQ] 基本版支持,但重试编号无法得到
93+
[Beanstalk], [DB], [File][Redis] 驱动程序实现了对可重试作业的完全支持
94+
[Sync] 驱动不会重试失败的作业 [Gearman] 不支持重试作业
95+
[RabbitMQ] 只有其基本的可重试支持,其中无法设置尝试次数
9196

9297
[Beanstalk]: driver-beanstalk.md
9398
[DB]: driver-db.md
9499
[File]: driver-file.md
95100
[Redis]: driver-redis.md
96101
[Sync]: driver-sync.md
97102
[Gearman]: driver-gearman.md
98-
[RabbitMQ]: driver-amqp.md
103+
[RabbitMQ]: driver-amqp.md

psalm.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,19 @@
2727
</stubs>
2828
<issueHandlers>
2929
<MixedAssignment errorLevel="suppress"/>
30+
<PropertyNotSetInConstructor errorLevel="suppress" />
31+
<RedundantPropertyInitializationCheck errorLevel="suppress" />
32+
<RiskyTruthyFalsyComparison errorLevel="suppress" />
33+
<MissingOverrideAttribute errorLevel="suppress" />
34+
<!-- for BC -->
35+
<ClassMustBeFinal errorLevel="suppress"/>
36+
<FalsableReturnStatement errorLevel="suppress"/>
37+
<PossiblyFalseArgument errorLevel="suppress"/>
38+
<PossiblyFalsePropertyAssignmentValue errorLevel="suppress"/>
39+
<PossiblyFalseIterator errorLevel="suppress"/>
40+
<InvalidFalsableReturnType errorLevel="suppress"/>
41+
<InvalidOperand errorLevel="suppress"/>
42+
<MixedArgument errorLevel="suppress"/>
43+
<MissingClassConstType errorLevel="suppress"/>
3044
</issueHandlers>
3145
</psalm>

src/InvalidJobException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function __construct(
3333
private readonly string $serialized,
3434
string $message = '',
3535
int $code = 0,
36-
Throwable $previous = null
36+
?Throwable $previous = null
3737
)
3838
{
3939
parent::__construct($message, $code, $previous);

src/JobEvent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ abstract class JobEvent extends Event
2727
/**
2828
* @var Queue
2929
* @inheritdoc
30-
* @psalm-suppress PropertyNotSetInConstructor, NonInvariantDocblockPropertyType
30+
* @psalm-suppress NonInvariantDocblockPropertyType
3131
*/
3232
public $sender;
3333
/**

0 commit comments

Comments
 (0)