The Laravel team released v13.34.0 with an opt-in way to count worker crashes toward a job's
maxExceptions
, a timeout signal for interruptible jobs, a
duration
财产在
JobProcessed
event, a
--queue
选择
queue:flush
, 和更多。
Count Worker Crashes Toward maxExceptions
William Julian-Vicary
贡献了一个
#[CountCrashesAsExceptions]
attribute for queued jobs. A job that throws an exception counts toward
$maxExceptions
, but a job whose worker dies mid-run (an out-of-memory kill, a segfault, or a container being stopped) does not. A job that uses
retryUntil()
with a rate limiter instead of
$tries
can keep crashing workers until its deadline passes.
With the attribute, a crashed attempt counts as one exception:
使用
Illuminate\Queue\Attributes\CountCrashesAsExceptions
;使用
Illuminate\Queue\Attributes\MaxExceptions
;#[
MaxExceptions
(
3
),
CountCrashesAsExceptions
]班级
流程播客
实现
应该排队{
民众
功能
retryUntil
()
:
日期时间{
返回
现在
()
->
添加小时
();}}
A
public $countCrashesAsExceptions = true;
property works the same way. The worker writes a cache key when it starts an opted-in job and removes it when the attempt ends. If the key is still there on the next attempt, the previous one died, and the worker counts it against
maxExceptions
. The job needs a
maxExceptions
value, and each attempt adds two cache calls, which is why the feature is opt-in.
看 #61737 更多细节。
Interruptible Jobs Are Notified Before a Timeout
杰克·贝利斯
updated the worker so a job that implements the
Interruptible
contract receives
SIGALRM
when it hits its timeout. Before this release, the worker passed
SIGTERM
and similar signals to
interruptible jobs
, but a timeout killed the worker without calling the job first. The job can now save its progress before it is marked as failed:
使用
Illuminate\Contracts\Queue\Interruptible
;班级
GenerateReport
实现
应该排队
,
Interruptible{
民众
功能
interrupted
(
整数
$signal)
:
空白{
如果
($signal
===
SIGALRM
){
$this
->
保存进度
();}}}
The worker also dispatches the
JobInterrupted
event added in
Laravel 13.31
, and reports any exception thrown by
interrupted()
without blocking the timeout.
看 #61651 更多细节。
Job Duration on JobProcessed
Jack Bayliss also added a
duration
property to the
JobProcessed
event, in milliseconds. Before, you had to listen for
JobProcessing
和
JobProcessed
and track the start time yourself:
使用
Illuminate\Queue\Events\JobProcessed
;事件
::
听
(
功能
(
JobProcessed
$event) {
日志
::
信息
(
"{
$事件
->
工作
->
resolveName
()} took {
$事件
->
期间
}多发性硬化症”
(英文):});
The value is a float rounded to two decimal places. It is
null
when the event is dispatched from somewhere other than the worker.
看 #61672 更多细节。
Flush Failed Jobs for One Queue
queue:flush
deletes every failed job on every queue. Jack Bayliss added a
--queue
option, so after a third-party API outage you can clear the failures from the affected queue and keep the rest:
php
工匠
queue:flush
--queue=sftp-sync# Combine with --hours to keep recent failuresphp
工匠
queue:flush
--queue=sftp-sync
--hours=48
看 #61630 更多细节。
Schema::getColumn()
Francescu Garoby
添加
Schema::getColumn()
, which returns the details for one column instead of the full list from
getColumns()
:
$列
=
架构
::
getColumn
(
“用户”
,
'电子邮件'
(英文):$column[
'type_name'
];
// "varchar"$column[
‘可空’
];
// 错误的
It returns an empty array when the column does not exist.
看 #61759 更多细节。
assertDatabaseCount() Accepts an Array
Jack Bayliss updated
assertDatabaseCount()
to accept an array of table and count pairs, so you can check several tables in one call:
$this
->
assertDatabaseCount
([
Person
::班级
=>
1
,
票
::班级
=>
2
,
电影
=>
10
,]);
看 #61727 更多细节。
Enums in Environment Checks
Dennis Petersmann
更新
App::environment()
and the scheduler's
environments()
method to accept enums. Passing an enum to
App::environment()
threw an error, and passing one to
environments()
on a scheduled task caused the task to never run:
枚举
环境
:
细绳{
案件
Staging
=
“舞台”
;
案件
生产
=
'生产'
;}应用程序
::
环境
(
环境
::
生产
(英文):日程
::
命令
(
'reports:send'
)
->
日常的
()
->
环境
(
环境
::
生产
(英文):
这
@env
Blade directive compiles to
App::environment()
, so it accepts enums too. In a separate PR, Jack Bayliss updated
Queue::isPaused()
to accept enums, matching
Queue::pause()
和
Queue::resume()
(
#61725
)。
看 #61730 更多细节。
requireMorphMap() Applies on Read
Pauline Vos
extended
Relation::requireMorphMap()
to the read side of polymorphic relations. With it turned on, Laravel already threw a
ClassMorphViolationException
when saving a model with no morph map entry. When loading a
morphTo
relation, an unmapped
*_type
value was still used as a class name. Laravel now throws the same exception when a
*_type
value is not in the morph map, for both lazy and eager loading.
Applications that do not call
requireMorphMap()
are not affected.
看 #61711 更多细节。
发行说明
您可以在下面查看新功能和更新的完整列表以及之间的差异 13.33.0 and 13.34.0 在 GitHub 上。以下发行说明直接来自 变更日志 :
v13.34.0
- [13.x] Include duration in JobProcessed event by @jackbayliss 在 #61672
- [13.x] Notify job when a timeout is going to occur by @jackbayliss 在 #61651
- [13.x] Add --queue option to queue:flush by @jackbayliss 在 #61630
- Allow null in docblocks to match existing code by @miclf 在 #61679
- [13.x] Support LazyCollection values in between clauses by @vikas-kushwaha-dev 在 #61678
- [13.x] Sync refreshed attributes to original state after increment / decrement by @ilhammmaulana 在 #61680
- [13.x] Fix
Number::parseInt()returning false for values above 32-bit range by @sumaiazaman 在 #61691 - [13.x] Fix
PhpRedisLock::refresh()when phpredis serialization is enabled by @sumaiazaman 在 #61690 - [13.x] Fix Collection::mode() returning values not present in the data when nulls exist by @MoZayedSaeid 在 #61686
- [13.x] Adjust some worker docblocks by @jackbayliss 在 #61683
- [13.x] Respect the relation's owner key in whereMorphedTo / whereNotMorphedTo by @axlon 在 #61712
- Enforce morph map on read side of polymorphic relations by @paulinevos 在 #61711
- [13.x] Display error in
queue:restartwhen worker isn't restartable by @jackbayliss 在 #61706 - [13.x] Test Improvements by @crynobone 在 #61697
- [13.x] Throw ValueError in LazyCollection::combine() on mismatched lengths by @mrjavadseydi 在 #61696
- [13.x] Fix
trans_choice()picking the wrong plural form for negative numbers by @sumaiazaman 在 #61700 - [13.x] Don't swallow deadlocks in
DatabaseLockinside a transaction by @lazerg 在 #61708 - [13.x] Fix
sortBy()with multiple columns andSORT_NUMERICtruncating fractional values by @sumaiazaman 在 #61699 - [13.x] Fix Number::format(), percentage() and currency() returning "-0" by @mrjavadseydi 在 #61716
- [13.x] Allow assertDatabaseCount to accept an array by @jackbayliss 在 #61727
- [13.x] Fix multipart requests losing attached stream contents on retry by @mehdishakki 在 #61728
- [13.x] Allow enums in Queue::isPaused() by @jackbayliss 在 #61725
- [13.x] Fix double negation in Eloquent
whereNot()with array conditions by @Nejcc 在 #61721 - [13.x] Allow enums in environment checks by @Taldres 在 #61730
- [13.x] Return an empty collection from
shift($count)在空的集合上 @Nejcc 在 #61723 - [13.x] Test with real objects by @jasonmccreary 在 #61663
- [13.x] Cloud exceptions by @蒂麦克唐纳 在 #61704
- [13.x] Run workflows on Windows 2025 by @jnoordsij 在 #61718
- [13.x] Use constant time lookups for validator exclusions by @owenconti 在 #61698
- [13.x] Preserve existing PDO options when forcing emulated prepares for pooled Cloud Postgres by @laurenschristian 在 #61735
- [13.x] Fix using elsePushIf blade directive with complex conditions by @mrjavadseydi 在 #61741
- [13.x] Fix Memcached locks longer than 30 days expiring immediately by @sumaiazaman 在 #61742
- [13.x] Allow jobs to count worker crashes towards maxExceptions by @williamjulianvicary 在 #61737
- [13.x] Fix Redis throttle returning a timestamp as the remaining attempts by @sumaiazaman 在 #61748
- Fix typos for Markdown files by @彼得279k 在 #61746
- [13.x] Support named S3 credential providers and Cloud IAM disks by @kieranbrown 在 #61676
- [13.x] Supports
phpstan/phpstan:2.2.15经过 @crynobone 在 #61719 - [13.x] feat: add the new 'Database\Schema\Builder::getColumn' method by @fgaroby 在 #61759
- Apply fixes from StyleCI by @泰勒韦尔 在 #61763
- [13.x] Fix through() returning HasOneThrough for MorphMany relations by @mrjavadseydi 在 #61760
- [13.x] Exclude refreshed attributes when replicating models by @ilhammmaulana 在 #61751
- [13.x] Fix
wherePivotBetween()being ignored bysync(),detach()和updateExistingPivot()经过 @sumaiazaman 在 #61747 - [13.x] Fix flaky scheduling test on Windows by @jasonmccreary 在 #61768
- [13.x] Fix findOrFail() with an array of enum ids by @jabysa 在 #61765
- [13.x] Fix
Builder::with()when a null callback is passed explicitly by @lazerg 在 #61769 - Final Mockery cleanup by @jasonmccreary 在 #61739
- [13.x] Treat dotted keys literally in ArrayStore::touch() by @Button99 在 #61777
- [13.x] Fix memoized tagged cache
many()returning null for numeric keys by @sajjadhossainshohag 在 #61780 - [13.x] Add regression test for createPayloadUsing on the queue manager by @fajarwz 在 #61773
- [13.x] Add mime type to the files reportable details by @sbourouis 在 #61772
- [13.x] Explicitly enable imagick extension for CI tests by @jnoordsij 在 #61756







