From c4f3e7f451c1d7cd7dda3f2bc78878ed626bdb8e Mon Sep 17 00:00:00 2001 From: Richard McDaniel <1130888+rmcdaniel@users.noreply.github.com> Date: Thu, 19 Nov 2026 16:19:33 +0000 Subject: [PATCH 1/5] Document the queue worker job timeout for workflow tasks With pcntl, queue:work kills a job after --timeout seconds (60 by default). A workflow task killed that way is rolled back and retried after its lease expires, so a task that always needs longer never completes (durable-workflow/workflow#1231). Document running workflow workers with --timeout=0 or above the longest workflow task in Running Workers, and link it from every page that starts a workflow worker. Co-Authored-By: Claude Opus 5.5 --- docs/configuration/microservices.md | 2 +- docs/installation.md | 10 ++++++++++ docs/laravel-adoption.md | 2 ++ docs/quickstart.md | 2 ++ docs/sample-app.md | 2 ++ 5 files changed, 17 insertions(+), 1 deletion(-) diff --git a/docs/configuration/microservices.md b/docs/configuration/microservices.md index 1f5a0a8cfa3..c7ff23fe315 100644 --- a/docs/configuration/microservices.md +++ b/docs/configuration/microservices.md @@ -131,4 +131,4 @@ php artisan queue:work shared --queue=workflows php artisan queue:work shared --queue=activities ``` -App A's worker replays workflows and schedules activity tasks. App B's worker picks up those activity tasks, executes them, and returns results. The engine handles the handoff through the shared database. +App A's worker replays workflows and schedules activity tasks. Set its job timeout as described in [Worker timeout](/docs/installation/#worker-timeout). App B's worker picks up those activity tasks, executes them, and returns results. The engine handles the handoff through the shared database. diff --git a/docs/installation.md b/docs/installation.md index 87ccd80a86f..0f1e55100ca 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -62,3 +62,13 @@ php artisan migrate ## Running Workers Durable Workflow uses queues to run workflows and activities in the background. You will need to either run the `queue:work` [command](https://laravel.com/docs/12.x/queues#the-queue-work-command) or use [Horizon](https://laravel.com/docs/12.x/horizon) to run your queue workers. Without a queue worker, workflows and activities will not be processed. To run workflows and activities in parallel, you will need more than one queue worker. + +### Worker timeout {#worker-timeout} + +```bash +php artisan queue:work --timeout=0 +``` + +When PHP has the `pcntl` extension, `queue:work` kills any job that runs longer than `--timeout` seconds, which defaults to 60. A workflow task killed this way is rolled back. It is retried after its workflow task lease expires (300 seconds by default), and the retry repeats the same work. A workflow task that always needs longer than the timeout, such as one that schedules or finishes a wide `all()`, never completes. + +Run workflow workers with `--timeout=0`, or with a value above your longest workflow task. Keep `workflows.v2.workflow_task_lease_seconds` above that value. In Horizon, the supervisor's `timeout` option is the same setting. diff --git a/docs/laravel-adoption.md b/docs/laravel-adoption.md index e2db3c21cd3..2369579f71b 100644 --- a/docs/laravel-adoption.md +++ b/docs/laravel-adoption.md @@ -298,6 +298,8 @@ Run the Laravel queue worker exactly as an embedded deployment requires: php artisan queue:work redis --queue=orders ``` +Set this worker's job timeout as described in [Worker timeout](/docs/installation/#worker-timeout). + Use the embedded fake through the same application action. It executes ready workflow tasks inline and records activity dispatches: diff --git a/docs/quickstart.md b/docs/quickstart.md index b86aef9f6a7..75ed98c25ef 100644 --- a/docs/quickstart.md +++ b/docs/quickstart.md @@ -454,6 +454,8 @@ php artisan migrate php artisan queue:work ``` +Before running wide fan-outs, set the worker's job timeout as described in [Worker timeout](/docs/installation/#worker-timeout). + When you want the operator UI inside that same Laravel application, add the qualified embedded Waterline Composer package: diff --git a/docs/sample-app.md b/docs/sample-app.md index 42338d896a6..20c18294af3 100644 --- a/docs/sample-app.md +++ b/docs/sample-app.md @@ -124,6 +124,8 @@ Start the queue worker. This will enable the processing of workflows and activit php artisan queue:work ``` +In your own application, set the worker's job timeout as described in [Worker timeout](/docs/installation/#worker-timeout). + When you want to prove the repair loop itself without waiting for a busy queue worker to hit another `Looping` cycle, run one explicit recovery sweep from a second terminal: ```bash From cdfa74c243e1c4ed2cf369b23eb9d54620abfa38 Mon Sep 17 00:00:00 2001 From: Richard McDaniel <1130888+rmcdaniel@users.noreply.github.com> Date: Thu, 19 Nov 2026 16:22:55 +0000 Subject: [PATCH 2/5] Translate the worker timeout guidance into all seven locales Mirror the English Worker timeout subsection in Installation and the links to it from the quickstart, sample app, Laravel adoption and microservices guides into de, es, fr, ja, pt-BR, uk and zh-Hans, keeping the {#worker-timeout} anchor, commands and config keys unchanged. Record the reviewed English source hashes for the five guides in each locale's source-hashes.json. Co-Authored-By: Claude Opus 5.5 --- .../current/configuration/microservices.md | 8 +++++--- .../current/installation.md | 10 ++++++++++ .../current/laravel-adoption.md | 2 ++ .../current/quickstart.md | 2 ++ .../current/sample-app.md | 2 ++ i18n/de/source-hashes.json | 10 +++++----- .../current/configuration/microservices.md | 2 +- .../current/installation.md | 18 ++++++++++++++++++ .../current/laravel-adoption.md | 3 +++ .../current/quickstart.md | 4 ++++ .../current/sample-app.md | 2 ++ i18n/es/source-hashes.json | 10 +++++----- .../current/configuration/microservices.md | 2 +- .../current/installation.md | 10 ++++++++++ .../current/laravel-adoption.md | 3 +++ .../current/quickstart.md | 4 ++++ .../current/sample-app.md | 4 ++++ i18n/fr/source-hashes.json | 10 +++++----- .../current/configuration/microservices.md | 2 +- .../current/installation.md | 10 ++++++++++ .../current/laravel-adoption.md | 2 ++ .../current/quickstart.md | 2 ++ .../current/sample-app.md | 2 ++ i18n/ja/source-hashes.json | 10 +++++----- .../current/configuration/microservices.md | 2 +- .../current/installation.md | 19 +++++++++++++++++++ .../current/laravel-adoption.md | 3 +++ .../current/quickstart.md | 3 +++ .../current/sample-app.md | 3 +++ i18n/pt-BR/source-hashes.json | 10 +++++----- .../current/configuration/microservices.md | 8 +++++--- .../current/installation.md | 19 +++++++++++++++++++ .../current/laravel-adoption.md | 3 +++ .../current/quickstart.md | 3 +++ .../current/sample-app.md | 3 +++ i18n/uk/source-hashes.json | 10 +++++----- .../current/configuration/microservices.md | 2 +- .../current/installation.md | 10 ++++++++++ .../current/laravel-adoption.md | 2 ++ .../current/quickstart.md | 2 ++ .../current/sample-app.md | 2 ++ i18n/zh-Hans/source-hashes.json | 10 +++++----- 42 files changed, 202 insertions(+), 46 deletions(-) diff --git a/i18n/de/docusaurus-plugin-content-docs/current/configuration/microservices.md b/i18n/de/docusaurus-plugin-content-docs/current/configuration/microservices.md index 8c58733f498..a00d79d3181 100644 --- a/i18n/de/docusaurus-plugin-content-docs/current/configuration/microservices.md +++ b/i18n/de/docusaurus-plugin-content-docs/current/configuration/microservices.md @@ -138,6 +138,8 @@ php artisan queue:work shared --queue=activities ``` Der Worker von Anwendung A spielt Workflows erneut ab und plant -Aktivitätsaufgaben ein. Der Worker von Anwendung B übernimmt diese Aufgaben, -führt sie aus und gibt Ergebnisse zurück. Die Engine wickelt die Übergabe -über die gemeinsame Datenbank ab. +Aktivitätsaufgaben ein. Legen Sie sein Job-Timeout wie unter +[Worker-Timeout](/docs/installation/#worker-timeout) beschrieben fest. Der +Worker von Anwendung B übernimmt diese Aufgaben, führt sie aus und gibt +Ergebnisse zurück. Die Engine wickelt die Übergabe über die gemeinsame Datenbank +ab. diff --git a/i18n/de/docusaurus-plugin-content-docs/current/installation.md b/i18n/de/docusaurus-plugin-content-docs/current/installation.md index 7c53471e9e9..58648341ec7 100644 --- a/i18n/de/docusaurus-plugin-content-docs/current/installation.md +++ b/i18n/de/docusaurus-plugin-content-docs/current/installation.md @@ -54,3 +54,13 @@ php artisan migrate ## Worker ausführen {#running-workers} Durable Workflow führt Workflows und Aktivitäten im Hintergrund über Warteschlangen aus. Starten Sie Queue-Worker mit dem [Befehl `queue:work`](https://laravel.com/docs/12.x/queues#the-queue-work-command) oder mit [Horizon](https://laravel.com/docs/12.x/horizon). Ohne Queue-Worker werden Workflows und Aktivitäten nicht verarbeitet. Für parallele Ausführung benötigen Sie mehr als einen Queue-Worker. + +### Worker-Timeout {#worker-timeout} + +```bash +php artisan queue:work --timeout=0 +``` + +Wenn PHP die Erweiterung `pcntl` hat, beendet `queue:work` jeden Job, der länger als `--timeout` Sekunden läuft; der Standardwert ist 60. Eine so beendete Workflow-Aufgabe wird zurückgerollt. Sie wird erneut versucht, nachdem ihre Workflow-Aufgaben-Lease abgelaufen ist (standardmäßig 300 Sekunden), und der neue Versuch wiederholt dieselbe Arbeit. Eine Workflow-Aufgabe, die immer länger als das Timeout braucht, etwa eine, die ein breites `all()` plant oder abschließt, wird nie abgeschlossen. + +Führen Sie Workflow-Worker mit `--timeout=0` oder mit einem Wert über Ihrer längsten Workflow-Aufgabe aus. Halten Sie `workflows.v2.workflow_task_lease_seconds` über diesem Wert. In Horizon ist die Option `timeout` des Supervisors dieselbe Einstellung. diff --git a/i18n/de/docusaurus-plugin-content-docs/current/laravel-adoption.md b/i18n/de/docusaurus-plugin-content-docs/current/laravel-adoption.md index 46e498c22db..00968ae8c40 100644 --- a/i18n/de/docusaurus-plugin-content-docs/current/laravel-adoption.md +++ b/i18n/de/docusaurus-plugin-content-docs/current/laravel-adoption.md @@ -268,6 +268,8 @@ Starten Sie den Laravel-Warteschlangen-Worker so, wie es eine eingebettete Berei php artisan queue:work redis --queue=orders ``` +Legen Sie das Job-Timeout dieses Workers wie unter [Worker-Timeout](/docs/installation/#worker-timeout) beschrieben fest. + Verwenden Sie den eingebetteten Fake über dieselbe Anwendungsaktion. Er führt bereite Workflow-Aufgaben direkt aus und zeichnet Aktivitätszuteilungen auf: diff --git a/i18n/de/docusaurus-plugin-content-docs/current/quickstart.md b/i18n/de/docusaurus-plugin-content-docs/current/quickstart.md index 06c96b36175..4513148a58b 100644 --- a/i18n/de/docusaurus-plugin-content-docs/current/quickstart.md +++ b/i18n/de/docusaurus-plugin-content-docs/current/quickstart.md @@ -422,6 +422,8 @@ php artisan migrate php artisan queue:work ``` +Bevor Sie breite Fan-outs ausführen, legen Sie das Job-Timeout des Workers wie unter [Worker-Timeout](/docs/installation/#worker-timeout) beschrieben fest. + Für die Betriebsoberfläche in derselben Laravel-Anwendung installieren Sie das qualifizierte eingebettete Waterline-Composer-Paket: ```bash diff --git a/i18n/de/docusaurus-plugin-content-docs/current/sample-app.md b/i18n/de/docusaurus-plugin-content-docs/current/sample-app.md index a6a96b8072c..c84873be94a 100644 --- a/i18n/de/docusaurus-plugin-content-docs/current/sample-app.md +++ b/i18n/de/docusaurus-plugin-content-docs/current/sample-app.md @@ -105,6 +105,8 @@ Starten Sie den Warteschlangen-Worker. Damit werden Workflows und Aktivitäten v php artisan queue:work ``` +Legen Sie in Ihrer eigenen Anwendung das Job-Timeout des Workers wie unter [Worker-Timeout](/docs/installation/#worker-timeout) beschrieben fest. + Wenn Sie die Reparaturschleife selbst nachweisen möchten, ohne auf einen weiteren `Looping`-Zyklus eines beschäftigten Warteschlangen-Workers zu warten, starten Sie in einem zweiten Terminal einen expliziten Wiederherstellungsdurchlauf: ```bash diff --git a/i18n/de/source-hashes.json b/i18n/de/source-hashes.json index 3be9b470028..03fa661e095 100644 --- a/i18n/de/source-hashes.json +++ b/i18n/de/source-hashes.json @@ -8,7 +8,7 @@ "configuration/customization-matrix.md": "3d115863eaee7852b541bcd01615f424cc19c5847c7cd7d75e5ae63bc3f5cc78", "configuration/database-connection.md": "cc83ae77133236309506fa44d39bfd0c939c32a6154c0bd6099bc64c83bdaec9", "configuration/ensuring-same-server.md": "6c665f37cc198c7b1a775a60a94aab5ff4e55383385e76f1834c7840559b512a", - "configuration/microservices.md": "46dc4afa07588b78829a7e3d259177ce0cf40861f0e31b88dbb6de3a83aa5488", + "configuration/microservices.md": "7421f8f18b62bc326601e2670ba15ba45fb02056da0d70e94ef89b3870f79cb0", "configuration/options.md": "d5079c5059aaa1072693ac09b3b8ea2be9176279820459370e5ebe6660d9f43b", "configuration/pruning-workflows.md": "6f6ee2be3bd185ffec764e86c3ed3cbd40c45f75d28671b4cd11226493e11afb", "configuration/publishing-config.md": "c757acd749c0d2696a6e19484249c9298dd15970ce0cf2ae0e6d2dfd82c8b6d6", @@ -60,9 +60,9 @@ "features/webhooks.md": "edcdfc05ccb0d34a77c51594f85bc3cab343e787f8e0e08d2cd4ddebd048e8c8", "features/worker-sessions.md": "5065368fb5b93599dbd08d97cb9ac312576eb42fee14f081db663aa9f78fb68c", "how-it-works.md": "90454c37f4244297d5c11bcc59549859acf59f88d15ecd26f0a6951c115f86eb", - "installation.md": "895d390a17a71f4846223c4637ed1e70adf1221ba99d6b422ce1a5480c2f167b", + "installation.md": "1384821f2c5069cfa2b6f51445aba7fc10c021ea3215e32c47afbfb207180416", "introduction.md": "06bf96d164d402d4e376c6308b20f96d324110b2e0cf96c2a1a67b39906072e3", - "laravel-adoption.md": "8974d4906658a0727a185ba3d53bf03e8e33494cd63d84def0b9ae62fcc7507e", + "laravel-adoption.md": "55a4df64436667b9477c9a39dd69ddde9f4c30739ba3dfd2ff316b553a55ba4f", "mcp-workflows.md": "1c0b5bb7f2e5c7ca835dfdfa57bbe8f6624172c855f4e225057ac2377abf360e", "migration.md": "7304a53786d5e45d3a639c33386e6558e855ee77982883a5e051ef5084b8453b", "monitoring.md": "346b8a5207b7d69cea63dc9bfec95bf1911d3038a9d30ad06939b13130079279", @@ -102,9 +102,9 @@ "polyglot/worker-compatibility-routing.md": "ef58f23c112f0e6b968927ba861177903adca21ed33b6b9371681e23a18b2994", "polyglot/worker-protocol.md": "91b18b39d626c1288bfa3f6b8212fa8246aa14393cb489a39fe90379bc4cd4b2", "polyglot/workflow-streams.md": "5675a8ea1b9d0b1f7223fecb90b3b048d3006670bf505950bc783709287a6432", - "quickstart.md": "887c6b500e17d41e6098f97f62e07ab3f2a05cd94e36aed93bf05fcce7b532e2", + "quickstart.md": "744ad91ea47202d056e14f6582dd751c471d329433565bcc4cb4182ae4cc76fb", "rolling-upgrades.md": "6acff017f2148d4f7553ebd4811aff8bde59cf6da4251845f4240ef7d1b1a970", - "sample-app.md": "d9cfd76ef3830c9a945949f2b7ca720e6434dbb15dcea96749c01f7e688534db", + "sample-app.md": "0a5e7c704344750c49dccac5e1be058471a70ad2dc68f82bf3920dee30e08cde", "sdk-neutrality.md": "7b0714c123ade4904591870fc20e9a797da1e5485b2a6c87ca3eaa00c5de6ed6", "sponsors.md": "e85e14375743ca8fa50e3a48f894b160e28272573aa88480064f74010ebee98a", "support.md": "706807b3902599dda6080f632ec1f893017ea18bbe9585f533dcdbd6d85f4621", diff --git a/i18n/es/docusaurus-plugin-content-docs/current/configuration/microservices.md b/i18n/es/docusaurus-plugin-content-docs/current/configuration/microservices.md index 6d58bdab0c4..fb7c176e65f 100644 --- a/i18n/es/docusaurus-plugin-content-docs/current/configuration/microservices.md +++ b/i18n/es/docusaurus-plugin-content-docs/current/configuration/microservices.md @@ -131,4 +131,4 @@ php artisan queue:work shared --queue=workflows php artisan queue:work shared --queue=activities ``` -El worker de la aplicación A reproduce los workflows y programa tareas de actividad. El worker de la aplicación B recoge esas tareas, las ejecuta y devuelve resultados. El motor gestiona el traspaso mediante la base de datos compartida. +El worker de la aplicación A reproduce los workflows y programa tareas de actividad. Configura su tiempo límite de jobs como se describe en [Tiempo límite del worker](/docs/installation/#worker-timeout). El worker de la aplicación B recoge esas tareas, las ejecuta y devuelve resultados. El motor gestiona el traspaso mediante la base de datos compartida. diff --git a/i18n/es/docusaurus-plugin-content-docs/current/installation.md b/i18n/es/docusaurus-plugin-content-docs/current/installation.md index 41fb3739ed2..d547579be9e 100644 --- a/i18n/es/docusaurus-plugin-content-docs/current/installation.md +++ b/i18n/es/docusaurus-plugin-content-docs/current/installation.md @@ -68,3 +68,21 @@ plano. Necesitas ejecutar el [comando `queue:work`](https://laravel.com/docs/12. o usar [Horizon](https://laravel.com/docs/12.x/horizon) para administrar los workers de las colas. Sin un worker, los workflows y las actividades no se procesan. Para ejecutarlos en paralelo, necesitas más de un worker. + +### Tiempo límite del worker {#worker-timeout} + +```bash +php artisan queue:work --timeout=0 +``` + +Cuando PHP tiene la extensión `pcntl`, `queue:work` termina cualquier job que se +ejecute durante más de `--timeout` segundos, que por defecto son 60. Una tarea +de workflow terminada así se revierte. Se reintenta cuando vence su lease de +tarea de workflow (300 segundos por defecto), y el reintento repite el mismo +trabajo. Una tarea de workflow que siempre necesita más tiempo que el límite, +como una que programa o termina un `all()` amplio, nunca se completa. + +Ejecuta los workers de workflows con `--timeout=0` o con un valor superior a tu +tarea de workflow más larga. Mantén `workflows.v2.workflow_task_lease_seconds` +por encima de ese valor. En Horizon, la opción `timeout` del supervisor es el +mismo ajuste. diff --git a/i18n/es/docusaurus-plugin-content-docs/current/laravel-adoption.md b/i18n/es/docusaurus-plugin-content-docs/current/laravel-adoption.md index 57d78ba5dc6..3c54f7b6716 100644 --- a/i18n/es/docusaurus-plugin-content-docs/current/laravel-adoption.md +++ b/i18n/es/docusaurus-plugin-content-docs/current/laravel-adoption.md @@ -298,6 +298,9 @@ Ejecuta el worker de colas Laravel según el despliegue integrado: php artisan queue:work redis --queue=orders ``` +Configura el tiempo límite de jobs de este worker como se describe en +[Tiempo límite del worker](/docs/installation/#worker-timeout). + Usa la simulación integrada desde la misma acción. Ejecuta inmediatamente las tareas listas y registra despachos de actividad: diff --git a/i18n/es/docusaurus-plugin-content-docs/current/quickstart.md b/i18n/es/docusaurus-plugin-content-docs/current/quickstart.md index b35b65cc098..56d313e233a 100644 --- a/i18n/es/docusaurus-plugin-content-docs/current/quickstart.md +++ b/i18n/es/docusaurus-plugin-content-docs/current/quickstart.md @@ -454,6 +454,10 @@ php artisan migrate php artisan queue:work ``` +Antes de ejecutar ramificaciones amplias, configura el tiempo límite de jobs del +worker como se describe en +[Tiempo límite del worker](/docs/installation/#worker-timeout). + Para añadir la interfaz de operación a esa misma aplicación, instala el paquete Composer de Waterline integrado: diff --git a/i18n/es/docusaurus-plugin-content-docs/current/sample-app.md b/i18n/es/docusaurus-plugin-content-docs/current/sample-app.md index 1e2a6a212eb..1f37495a76f 100644 --- a/i18n/es/docusaurus-plugin-content-docs/current/sample-app.md +++ b/i18n/es/docusaurus-plugin-content-docs/current/sample-app.md @@ -124,6 +124,8 @@ Inicia el worker de colas para procesar workflows y actividades. php artisan queue:work ``` +En tu propia aplicación, configura el tiempo límite de jobs del worker como se describe en [Tiempo límite del worker](/docs/installation/#worker-timeout). + Para comprobar el propio ciclo de reparación sin esperar a que un worker ocupado llegue a otro ciclo `Looping`, ejecuta una pasada explícita de recuperación desde un segundo terminal: ```bash diff --git a/i18n/es/source-hashes.json b/i18n/es/source-hashes.json index 3be9b470028..03fa661e095 100644 --- a/i18n/es/source-hashes.json +++ b/i18n/es/source-hashes.json @@ -8,7 +8,7 @@ "configuration/customization-matrix.md": "3d115863eaee7852b541bcd01615f424cc19c5847c7cd7d75e5ae63bc3f5cc78", "configuration/database-connection.md": "cc83ae77133236309506fa44d39bfd0c939c32a6154c0bd6099bc64c83bdaec9", "configuration/ensuring-same-server.md": "6c665f37cc198c7b1a775a60a94aab5ff4e55383385e76f1834c7840559b512a", - "configuration/microservices.md": "46dc4afa07588b78829a7e3d259177ce0cf40861f0e31b88dbb6de3a83aa5488", + "configuration/microservices.md": "7421f8f18b62bc326601e2670ba15ba45fb02056da0d70e94ef89b3870f79cb0", "configuration/options.md": "d5079c5059aaa1072693ac09b3b8ea2be9176279820459370e5ebe6660d9f43b", "configuration/pruning-workflows.md": "6f6ee2be3bd185ffec764e86c3ed3cbd40c45f75d28671b4cd11226493e11afb", "configuration/publishing-config.md": "c757acd749c0d2696a6e19484249c9298dd15970ce0cf2ae0e6d2dfd82c8b6d6", @@ -60,9 +60,9 @@ "features/webhooks.md": "edcdfc05ccb0d34a77c51594f85bc3cab343e787f8e0e08d2cd4ddebd048e8c8", "features/worker-sessions.md": "5065368fb5b93599dbd08d97cb9ac312576eb42fee14f081db663aa9f78fb68c", "how-it-works.md": "90454c37f4244297d5c11bcc59549859acf59f88d15ecd26f0a6951c115f86eb", - "installation.md": "895d390a17a71f4846223c4637ed1e70adf1221ba99d6b422ce1a5480c2f167b", + "installation.md": "1384821f2c5069cfa2b6f51445aba7fc10c021ea3215e32c47afbfb207180416", "introduction.md": "06bf96d164d402d4e376c6308b20f96d324110b2e0cf96c2a1a67b39906072e3", - "laravel-adoption.md": "8974d4906658a0727a185ba3d53bf03e8e33494cd63d84def0b9ae62fcc7507e", + "laravel-adoption.md": "55a4df64436667b9477c9a39dd69ddde9f4c30739ba3dfd2ff316b553a55ba4f", "mcp-workflows.md": "1c0b5bb7f2e5c7ca835dfdfa57bbe8f6624172c855f4e225057ac2377abf360e", "migration.md": "7304a53786d5e45d3a639c33386e6558e855ee77982883a5e051ef5084b8453b", "monitoring.md": "346b8a5207b7d69cea63dc9bfec95bf1911d3038a9d30ad06939b13130079279", @@ -102,9 +102,9 @@ "polyglot/worker-compatibility-routing.md": "ef58f23c112f0e6b968927ba861177903adca21ed33b6b9371681e23a18b2994", "polyglot/worker-protocol.md": "91b18b39d626c1288bfa3f6b8212fa8246aa14393cb489a39fe90379bc4cd4b2", "polyglot/workflow-streams.md": "5675a8ea1b9d0b1f7223fecb90b3b048d3006670bf505950bc783709287a6432", - "quickstart.md": "887c6b500e17d41e6098f97f62e07ab3f2a05cd94e36aed93bf05fcce7b532e2", + "quickstart.md": "744ad91ea47202d056e14f6582dd751c471d329433565bcc4cb4182ae4cc76fb", "rolling-upgrades.md": "6acff017f2148d4f7553ebd4811aff8bde59cf6da4251845f4240ef7d1b1a970", - "sample-app.md": "d9cfd76ef3830c9a945949f2b7ca720e6434dbb15dcea96749c01f7e688534db", + "sample-app.md": "0a5e7c704344750c49dccac5e1be058471a70ad2dc68f82bf3920dee30e08cde", "sdk-neutrality.md": "7b0714c123ade4904591870fc20e9a797da1e5485b2a6c87ca3eaa00c5de6ed6", "sponsors.md": "e85e14375743ca8fa50e3a48f894b160e28272573aa88480064f74010ebee98a", "support.md": "706807b3902599dda6080f632ec1f893017ea18bbe9585f533dcdbd6d85f4621", diff --git a/i18n/fr/docusaurus-plugin-content-docs/current/configuration/microservices.md b/i18n/fr/docusaurus-plugin-content-docs/current/configuration/microservices.md index c09d8d423c6..a7d97b53618 100644 --- a/i18n/fr/docusaurus-plugin-content-docs/current/configuration/microservices.md +++ b/i18n/fr/docusaurus-plugin-content-docs/current/configuration/microservices.md @@ -131,4 +131,4 @@ php artisan queue:work shared --queue=workflows php artisan queue:work shared --queue=activities ``` -Le worker de l’application A relit les workflows et programme les tâches d’activité. Celui de l’application B récupère ces tâches, les exécute et renvoie les résultats. Le moteur gère le passage de relais via la base de données partagée. +Le worker de l’application A relit les workflows et programme les tâches d’activité. Réglez son délai d’expiration des jobs comme décrit dans [Délai d’expiration du worker](/docs/installation/#worker-timeout). Celui de l’application B récupère ces tâches, les exécute et renvoie les résultats. Le moteur gère le passage de relais via la base de données partagée. diff --git a/i18n/fr/docusaurus-plugin-content-docs/current/installation.md b/i18n/fr/docusaurus-plugin-content-docs/current/installation.md index 85eee9aabc9..730d4adbd24 100644 --- a/i18n/fr/docusaurus-plugin-content-docs/current/installation.md +++ b/i18n/fr/docusaurus-plugin-content-docs/current/installation.md @@ -54,3 +54,13 @@ php artisan migrate ## Exécuter les workers {#running-workers} Durable Workflow utilise des files pour exécuter les workflows et les activités en arrière-plan. Exécutez la commande [`queue:work`](https://laravel.com/docs/12.x/queues#the-queue-work-command) ou utilisez [Horizon](https://laravel.com/docs/12.x/horizon) pour gérer vos workers de file. Sans worker, les workflows et les activités ne sont pas traités. Pour les exécuter en parallèle, il faut plusieurs workers. + +### Délai d’expiration du worker {#worker-timeout} + +```bash +php artisan queue:work --timeout=0 +``` + +Lorsque PHP dispose de l’extension `pcntl`, `queue:work` tue tout job qui s’exécute plus de `--timeout` secondes, 60 par défaut. Les changements d’une tâche de workflow tuée de cette façon sont annulés. Elle est relancée après l’expiration de son bail de tâche de workflow (300 secondes par défaut), et la nouvelle tentative refait le même travail. Une tâche de workflow qui a toujours besoin de plus de temps que ce délai, par exemple une tâche qui planifie ou termine un large `all()`, ne se termine jamais. + +Exécutez les workers de workflow avec `--timeout=0`, ou avec une valeur supérieure à votre plus longue tâche de workflow. Gardez `workflows.v2.workflow_task_lease_seconds` au-dessus de cette valeur. Dans Horizon, l’option `timeout` du superviseur est le même réglage. diff --git a/i18n/fr/docusaurus-plugin-content-docs/current/laravel-adoption.md b/i18n/fr/docusaurus-plugin-content-docs/current/laravel-adoption.md index c496b12829a..d4d9384d6b7 100644 --- a/i18n/fr/docusaurus-plugin-content-docs/current/laravel-adoption.md +++ b/i18n/fr/docusaurus-plugin-content-docs/current/laravel-adoption.md @@ -301,6 +301,9 @@ Lancez le worker Laravel comme l'exige le déploiement embarqué : php artisan queue:work redis --queue=orders ``` +Réglez le délai d'expiration des jobs de ce worker comme décrit dans +[Délai d'expiration du worker](/docs/installation/#worker-timeout). + Utilisez la simulation embarquée via la même action applicative. Elle exécute directement les tâches prêtes et enregistre les distributions d'activité : diff --git a/i18n/fr/docusaurus-plugin-content-docs/current/quickstart.md b/i18n/fr/docusaurus-plugin-content-docs/current/quickstart.md index 96c58d00ea4..ba5eab1a1e5 100644 --- a/i18n/fr/docusaurus-plugin-content-docs/current/quickstart.md +++ b/i18n/fr/docusaurus-plugin-content-docs/current/quickstart.md @@ -458,6 +458,10 @@ php artisan migrate php artisan queue:work ``` +Avant de lancer de larges fan-outs, réglez le délai d’expiration des jobs du +worker comme décrit dans +[Délai d’expiration du worker](/docs/installation/#worker-timeout). + Pour disposer de l’interface opérateur dans cette même application Laravel, ajoutez le package Composer Waterline intégré qualifié : diff --git a/i18n/fr/docusaurus-plugin-content-docs/current/sample-app.md b/i18n/fr/docusaurus-plugin-content-docs/current/sample-app.md index c1236b0c85e..8ac14c3a799 100644 --- a/i18n/fr/docusaurus-plugin-content-docs/current/sample-app.md +++ b/i18n/fr/docusaurus-plugin-content-docs/current/sample-app.md @@ -125,6 +125,10 @@ Démarrez le worker de file pour traiter workflows et activités. php artisan queue:work ``` +Dans votre propre application, réglez le délai d'expiration des jobs du worker +comme décrit dans +[Délai d'expiration du worker](/docs/installation/#worker-timeout). + Pour vérifier la boucle de réparation elle-même sans attendre un nouveau cycle `Looping` d'un worker occupé, lancez un passage explicite de reprise depuis un second terminal : diff --git a/i18n/fr/source-hashes.json b/i18n/fr/source-hashes.json index 3be9b470028..03fa661e095 100644 --- a/i18n/fr/source-hashes.json +++ b/i18n/fr/source-hashes.json @@ -8,7 +8,7 @@ "configuration/customization-matrix.md": "3d115863eaee7852b541bcd01615f424cc19c5847c7cd7d75e5ae63bc3f5cc78", "configuration/database-connection.md": "cc83ae77133236309506fa44d39bfd0c939c32a6154c0bd6099bc64c83bdaec9", "configuration/ensuring-same-server.md": "6c665f37cc198c7b1a775a60a94aab5ff4e55383385e76f1834c7840559b512a", - "configuration/microservices.md": "46dc4afa07588b78829a7e3d259177ce0cf40861f0e31b88dbb6de3a83aa5488", + "configuration/microservices.md": "7421f8f18b62bc326601e2670ba15ba45fb02056da0d70e94ef89b3870f79cb0", "configuration/options.md": "d5079c5059aaa1072693ac09b3b8ea2be9176279820459370e5ebe6660d9f43b", "configuration/pruning-workflows.md": "6f6ee2be3bd185ffec764e86c3ed3cbd40c45f75d28671b4cd11226493e11afb", "configuration/publishing-config.md": "c757acd749c0d2696a6e19484249c9298dd15970ce0cf2ae0e6d2dfd82c8b6d6", @@ -60,9 +60,9 @@ "features/webhooks.md": "edcdfc05ccb0d34a77c51594f85bc3cab343e787f8e0e08d2cd4ddebd048e8c8", "features/worker-sessions.md": "5065368fb5b93599dbd08d97cb9ac312576eb42fee14f081db663aa9f78fb68c", "how-it-works.md": "90454c37f4244297d5c11bcc59549859acf59f88d15ecd26f0a6951c115f86eb", - "installation.md": "895d390a17a71f4846223c4637ed1e70adf1221ba99d6b422ce1a5480c2f167b", + "installation.md": "1384821f2c5069cfa2b6f51445aba7fc10c021ea3215e32c47afbfb207180416", "introduction.md": "06bf96d164d402d4e376c6308b20f96d324110b2e0cf96c2a1a67b39906072e3", - "laravel-adoption.md": "8974d4906658a0727a185ba3d53bf03e8e33494cd63d84def0b9ae62fcc7507e", + "laravel-adoption.md": "55a4df64436667b9477c9a39dd69ddde9f4c30739ba3dfd2ff316b553a55ba4f", "mcp-workflows.md": "1c0b5bb7f2e5c7ca835dfdfa57bbe8f6624172c855f4e225057ac2377abf360e", "migration.md": "7304a53786d5e45d3a639c33386e6558e855ee77982883a5e051ef5084b8453b", "monitoring.md": "346b8a5207b7d69cea63dc9bfec95bf1911d3038a9d30ad06939b13130079279", @@ -102,9 +102,9 @@ "polyglot/worker-compatibility-routing.md": "ef58f23c112f0e6b968927ba861177903adca21ed33b6b9371681e23a18b2994", "polyglot/worker-protocol.md": "91b18b39d626c1288bfa3f6b8212fa8246aa14393cb489a39fe90379bc4cd4b2", "polyglot/workflow-streams.md": "5675a8ea1b9d0b1f7223fecb90b3b048d3006670bf505950bc783709287a6432", - "quickstart.md": "887c6b500e17d41e6098f97f62e07ab3f2a05cd94e36aed93bf05fcce7b532e2", + "quickstart.md": "744ad91ea47202d056e14f6582dd751c471d329433565bcc4cb4182ae4cc76fb", "rolling-upgrades.md": "6acff017f2148d4f7553ebd4811aff8bde59cf6da4251845f4240ef7d1b1a970", - "sample-app.md": "d9cfd76ef3830c9a945949f2b7ca720e6434dbb15dcea96749c01f7e688534db", + "sample-app.md": "0a5e7c704344750c49dccac5e1be058471a70ad2dc68f82bf3920dee30e08cde", "sdk-neutrality.md": "7b0714c123ade4904591870fc20e9a797da1e5485b2a6c87ca3eaa00c5de6ed6", "sponsors.md": "e85e14375743ca8fa50e3a48f894b160e28272573aa88480064f74010ebee98a", "support.md": "706807b3902599dda6080f632ec1f893017ea18bbe9585f533dcdbd6d85f4621", diff --git a/i18n/ja/docusaurus-plugin-content-docs/current/configuration/microservices.md b/i18n/ja/docusaurus-plugin-content-docs/current/configuration/microservices.md index 39c3b50a683..ff4942d8e90 100644 --- a/i18n/ja/docusaurus-plugin-content-docs/current/configuration/microservices.md +++ b/i18n/ja/docusaurus-plugin-content-docs/current/configuration/microservices.md @@ -131,4 +131,4 @@ php artisan queue:work shared --queue=workflows php artisan queue:work shared --queue=activities ``` -アプリ A の Worker はワークフローをリプレイし、アクティビティタスクをスケジュールします。アプリ B の Worker はそのタスクを取得して実行し、結果を返します。引き継ぎはエンジンが共有データベースを通じて処理します。 +アプリ A の Worker はワークフローをリプレイし、アクティビティタスクをスケジュールします。この Worker のジョブタイムアウトは、[Worker のタイムアウト](/docs/installation/#worker-timeout)の説明に従って設定してください。アプリ B の Worker はそのタスクを取得して実行し、結果を返します。引き継ぎはエンジンが共有データベースを通じて処理します。 diff --git a/i18n/ja/docusaurus-plugin-content-docs/current/installation.md b/i18n/ja/docusaurus-plugin-content-docs/current/installation.md index 1b61714dee0..1a779c92734 100644 --- a/i18n/ja/docusaurus-plugin-content-docs/current/installation.md +++ b/i18n/ja/docusaurus-plugin-content-docs/current/installation.md @@ -53,3 +53,13 @@ php artisan migrate ## Worker を実行する {#running-workers} Durable Workflow はキューを使って、ワークフローとアクティビティをバックグラウンドで実行します。[`queue:work` コマンド](https://laravel.com/docs/12.x/queues#the-queue-work-command)を実行するか、[Horizon](https://laravel.com/docs/12.x/horizon)でキュー Worker を管理してください。キュー Worker がなければ、ワークフローとアクティビティは処理されません。並列に実行するには、複数のキュー Worker が必要です。 + +### Worker のタイムアウト {#worker-timeout} + +```bash +php artisan queue:work --timeout=0 +``` + +PHP に `pcntl` 拡張がある場合、`queue:work` は `--timeout` 秒(デフォルトは 60)を超えて実行されたジョブを強制終了します。こうして強制終了されたワークフロータスクはロールバックされます。そのタスクはワークフロータスクのリース(デフォルトは 300 秒)の期限が切れた後に再試行され、再試行では同じ作業が繰り返されます。幅の広い `all()` をスケジュールまたは完了するタスクのように、常にタイムアウトより長い時間を必要とするワークフロータスクは、いつまでも完了しません。 + +ワークフロー Worker は `--timeout=0`、または最も長いワークフロータスクを上回る値で実行してください。`workflows.v2.workflow_task_lease_seconds` はその値より大きく保ってください。Horizon では、supervisor の `timeout` オプションが同じ設定です。 diff --git a/i18n/ja/docusaurus-plugin-content-docs/current/laravel-adoption.md b/i18n/ja/docusaurus-plugin-content-docs/current/laravel-adoption.md index 921587a6753..c736948951e 100644 --- a/i18n/ja/docusaurus-plugin-content-docs/current/laravel-adoption.md +++ b/i18n/ja/docusaurus-plugin-content-docs/current/laravel-adoption.md @@ -268,6 +268,8 @@ final class StartOrderFulfillment php artisan queue:work redis --queue=orders ``` +この Worker のジョブタイムアウトは、[Worker のタイムアウト](/docs/installation/#worker-timeout)の説明に従って設定してください。 + 同じアプリケーションアクションから組み込み fake を使います。準備済みタスクをインライン実行し、アクティビティ配送を記録します。 diff --git a/i18n/ja/docusaurus-plugin-content-docs/current/quickstart.md b/i18n/ja/docusaurus-plugin-content-docs/current/quickstart.md index f3295cae997..aeacde765a5 100644 --- a/i18n/ja/docusaurus-plugin-content-docs/current/quickstart.md +++ b/i18n/ja/docusaurus-plugin-content-docs/current/quickstart.md @@ -411,6 +411,8 @@ php artisan migrate php artisan queue:work ``` +大規模なファンアウトを実行する前に、[Worker のタイムアウト](/docs/installation/#worker-timeout)の説明に従って Worker のジョブタイムアウトを設定してください。 + 同じ Laravel アプリ内に運用 UI を追加したい場合は、検証済みの Waterline 組み込み Composer パッケージを追加します。 ```bash diff --git a/i18n/ja/docusaurus-plugin-content-docs/current/sample-app.md b/i18n/ja/docusaurus-plugin-content-docs/current/sample-app.md index b3fb2f6e17c..c98b0cf69bc 100644 --- a/i18n/ja/docusaurus-plugin-content-docs/current/sample-app.md +++ b/i18n/ja/docusaurus-plugin-content-docs/current/sample-app.md @@ -105,6 +105,8 @@ php artisan app:init php artisan queue:work ``` +自分のアプリケーションでは、[Worker のタイムアウト](/docs/installation/#worker-timeout)の説明に従って Worker のジョブタイムアウトを設定してください。 + 忙しいキュー Worker が次の `Looping` サイクルに達するのを待たず、修復ループ自体を検証したい場合は、別のターミナルから明示的な復旧スイープを一回実行します。 ```bash diff --git a/i18n/ja/source-hashes.json b/i18n/ja/source-hashes.json index 3be9b470028..03fa661e095 100644 --- a/i18n/ja/source-hashes.json +++ b/i18n/ja/source-hashes.json @@ -8,7 +8,7 @@ "configuration/customization-matrix.md": "3d115863eaee7852b541bcd01615f424cc19c5847c7cd7d75e5ae63bc3f5cc78", "configuration/database-connection.md": "cc83ae77133236309506fa44d39bfd0c939c32a6154c0bd6099bc64c83bdaec9", "configuration/ensuring-same-server.md": "6c665f37cc198c7b1a775a60a94aab5ff4e55383385e76f1834c7840559b512a", - "configuration/microservices.md": "46dc4afa07588b78829a7e3d259177ce0cf40861f0e31b88dbb6de3a83aa5488", + "configuration/microservices.md": "7421f8f18b62bc326601e2670ba15ba45fb02056da0d70e94ef89b3870f79cb0", "configuration/options.md": "d5079c5059aaa1072693ac09b3b8ea2be9176279820459370e5ebe6660d9f43b", "configuration/pruning-workflows.md": "6f6ee2be3bd185ffec764e86c3ed3cbd40c45f75d28671b4cd11226493e11afb", "configuration/publishing-config.md": "c757acd749c0d2696a6e19484249c9298dd15970ce0cf2ae0e6d2dfd82c8b6d6", @@ -60,9 +60,9 @@ "features/webhooks.md": "edcdfc05ccb0d34a77c51594f85bc3cab343e787f8e0e08d2cd4ddebd048e8c8", "features/worker-sessions.md": "5065368fb5b93599dbd08d97cb9ac312576eb42fee14f081db663aa9f78fb68c", "how-it-works.md": "90454c37f4244297d5c11bcc59549859acf59f88d15ecd26f0a6951c115f86eb", - "installation.md": "895d390a17a71f4846223c4637ed1e70adf1221ba99d6b422ce1a5480c2f167b", + "installation.md": "1384821f2c5069cfa2b6f51445aba7fc10c021ea3215e32c47afbfb207180416", "introduction.md": "06bf96d164d402d4e376c6308b20f96d324110b2e0cf96c2a1a67b39906072e3", - "laravel-adoption.md": "8974d4906658a0727a185ba3d53bf03e8e33494cd63d84def0b9ae62fcc7507e", + "laravel-adoption.md": "55a4df64436667b9477c9a39dd69ddde9f4c30739ba3dfd2ff316b553a55ba4f", "mcp-workflows.md": "1c0b5bb7f2e5c7ca835dfdfa57bbe8f6624172c855f4e225057ac2377abf360e", "migration.md": "7304a53786d5e45d3a639c33386e6558e855ee77982883a5e051ef5084b8453b", "monitoring.md": "346b8a5207b7d69cea63dc9bfec95bf1911d3038a9d30ad06939b13130079279", @@ -102,9 +102,9 @@ "polyglot/worker-compatibility-routing.md": "ef58f23c112f0e6b968927ba861177903adca21ed33b6b9371681e23a18b2994", "polyglot/worker-protocol.md": "91b18b39d626c1288bfa3f6b8212fa8246aa14393cb489a39fe90379bc4cd4b2", "polyglot/workflow-streams.md": "5675a8ea1b9d0b1f7223fecb90b3b048d3006670bf505950bc783709287a6432", - "quickstart.md": "887c6b500e17d41e6098f97f62e07ab3f2a05cd94e36aed93bf05fcce7b532e2", + "quickstart.md": "744ad91ea47202d056e14f6582dd751c471d329433565bcc4cb4182ae4cc76fb", "rolling-upgrades.md": "6acff017f2148d4f7553ebd4811aff8bde59cf6da4251845f4240ef7d1b1a970", - "sample-app.md": "d9cfd76ef3830c9a945949f2b7ca720e6434dbb15dcea96749c01f7e688534db", + "sample-app.md": "0a5e7c704344750c49dccac5e1be058471a70ad2dc68f82bf3920dee30e08cde", "sdk-neutrality.md": "7b0714c123ade4904591870fc20e9a797da1e5485b2a6c87ca3eaa00c5de6ed6", "sponsors.md": "e85e14375743ca8fa50e3a48f894b160e28272573aa88480064f74010ebee98a", "support.md": "706807b3902599dda6080f632ec1f893017ea18bbe9585f533dcdbd6d85f4621", diff --git a/i18n/pt-BR/docusaurus-plugin-content-docs/current/configuration/microservices.md b/i18n/pt-BR/docusaurus-plugin-content-docs/current/configuration/microservices.md index 728d1eb724f..9edf0a6d910 100644 --- a/i18n/pt-BR/docusaurus-plugin-content-docs/current/configuration/microservices.md +++ b/i18n/pt-BR/docusaurus-plugin-content-docs/current/configuration/microservices.md @@ -131,4 +131,4 @@ php artisan queue:work shared --queue=workflows php artisan queue:work shared --queue=activities ``` -O worker da aplicação A faz replay dos workflows e agenda tarefas de atividade. O worker da aplicação B recebe essas tarefas de atividade, executa-as e retorna os resultados. O mecanismo cuida da transferência pelo banco de dados compartilhado. +O worker da aplicação A faz replay dos workflows e agenda tarefas de atividade. Configure o timeout de jobs dele como descrito em [Timeout do worker](/docs/installation/#worker-timeout). O worker da aplicação B recebe essas tarefas de atividade, executa-as e retorna os resultados. O mecanismo cuida da transferência pelo banco de dados compartilhado. diff --git a/i18n/pt-BR/docusaurus-plugin-content-docs/current/installation.md b/i18n/pt-BR/docusaurus-plugin-content-docs/current/installation.md index 0ea4d6680e2..74a71d7af24 100644 --- a/i18n/pt-BR/docusaurus-plugin-content-docs/current/installation.md +++ b/i18n/pt-BR/docusaurus-plugin-content-docs/current/installation.md @@ -70,3 +70,22 @@ plano. Execute o [comando `queue:work`](https://laravel.com/docs/12.x/queues#the ou use o [Horizon](https://laravel.com/docs/12.x/horizon) para operar os workers de fila. Sem um worker, workflows e atividades não são processados. Para executá-los em paralelo, você precisa de mais de um worker de fila. + +### Timeout do worker {#worker-timeout} + +```bash +php artisan queue:work --timeout=0 +``` + +Quando o PHP tem a extensão `pcntl`, o `queue:work` encerra qualquer job que +rode por mais de `--timeout` segundos, que por padrão são 60. Uma tarefa de +workflow encerrada dessa forma sofre rollback. Ela é tentada novamente depois +que o lease da tarefa de workflow expira (300 segundos por padrão), e a nova +tentativa repete o mesmo trabalho. Uma tarefa de workflow que sempre precisa de +mais tempo que o timeout, como uma que agenda ou conclui um `all()` amplo, nunca +é concluída. + +Execute os workers de workflow com `--timeout=0` ou com um valor acima da sua +tarefa de workflow mais longa. Mantenha +`workflows.v2.workflow_task_lease_seconds` acima desse valor. No Horizon, a +opção `timeout` do supervisor é a mesma configuração. diff --git a/i18n/pt-BR/docusaurus-plugin-content-docs/current/laravel-adoption.md b/i18n/pt-BR/docusaurus-plugin-content-docs/current/laravel-adoption.md index 38712baf0d9..cfcce7b6acb 100644 --- a/i18n/pt-BR/docusaurus-plugin-content-docs/current/laravel-adoption.md +++ b/i18n/pt-BR/docusaurus-plugin-content-docs/current/laravel-adoption.md @@ -300,6 +300,9 @@ Execute o worker de fila Laravel exatamente como uma implantação integrada exi php artisan queue:work redis --queue=orders ``` +Configure o timeout de jobs deste worker como descrito em +[Timeout do worker](/docs/installation/#worker-timeout). + Use o fake integrado pela mesma ação da aplicação. Ele executa tarefas prontas de workflow no mesmo processo e registra despachos de atividades: diff --git a/i18n/pt-BR/docusaurus-plugin-content-docs/current/quickstart.md b/i18n/pt-BR/docusaurus-plugin-content-docs/current/quickstart.md index d7450d9d42e..4bc3f0427c3 100644 --- a/i18n/pt-BR/docusaurus-plugin-content-docs/current/quickstart.md +++ b/i18n/pt-BR/docusaurus-plugin-content-docs/current/quickstart.md @@ -458,6 +458,9 @@ php artisan migrate php artisan queue:work ``` +Antes de executar ramificações amplas, configure o timeout de jobs do worker +como descrito em [Timeout do worker](/docs/installation/#worker-timeout). + Para usar a interface de operação dentro da mesma aplicação Laravel, adicione o pacote Composer qualificado do Waterline integrado: diff --git a/i18n/pt-BR/docusaurus-plugin-content-docs/current/sample-app.md b/i18n/pt-BR/docusaurus-plugin-content-docs/current/sample-app.md index 0bfc3be8e18..4db559aca91 100644 --- a/i18n/pt-BR/docusaurus-plugin-content-docs/current/sample-app.md +++ b/i18n/pt-BR/docusaurus-plugin-content-docs/current/sample-app.md @@ -127,6 +127,9 @@ Inicie o worker de fila. Isso habilita o processamento de workflows e atividades php artisan queue:work ``` +Na sua própria aplicação, configure o timeout de jobs do worker como descrito em +[Timeout do worker](/docs/installation/#worker-timeout). + Para comprovar o próprio ciclo de reparo sem esperar um worker ocupado chegar a outro ciclo `Looping`, execute uma varredura explícita de recuperação em um segundo terminal: diff --git a/i18n/pt-BR/source-hashes.json b/i18n/pt-BR/source-hashes.json index 3be9b470028..03fa661e095 100644 --- a/i18n/pt-BR/source-hashes.json +++ b/i18n/pt-BR/source-hashes.json @@ -8,7 +8,7 @@ "configuration/customization-matrix.md": "3d115863eaee7852b541bcd01615f424cc19c5847c7cd7d75e5ae63bc3f5cc78", "configuration/database-connection.md": "cc83ae77133236309506fa44d39bfd0c939c32a6154c0bd6099bc64c83bdaec9", "configuration/ensuring-same-server.md": "6c665f37cc198c7b1a775a60a94aab5ff4e55383385e76f1834c7840559b512a", - "configuration/microservices.md": "46dc4afa07588b78829a7e3d259177ce0cf40861f0e31b88dbb6de3a83aa5488", + "configuration/microservices.md": "7421f8f18b62bc326601e2670ba15ba45fb02056da0d70e94ef89b3870f79cb0", "configuration/options.md": "d5079c5059aaa1072693ac09b3b8ea2be9176279820459370e5ebe6660d9f43b", "configuration/pruning-workflows.md": "6f6ee2be3bd185ffec764e86c3ed3cbd40c45f75d28671b4cd11226493e11afb", "configuration/publishing-config.md": "c757acd749c0d2696a6e19484249c9298dd15970ce0cf2ae0e6d2dfd82c8b6d6", @@ -60,9 +60,9 @@ "features/webhooks.md": "edcdfc05ccb0d34a77c51594f85bc3cab343e787f8e0e08d2cd4ddebd048e8c8", "features/worker-sessions.md": "5065368fb5b93599dbd08d97cb9ac312576eb42fee14f081db663aa9f78fb68c", "how-it-works.md": "90454c37f4244297d5c11bcc59549859acf59f88d15ecd26f0a6951c115f86eb", - "installation.md": "895d390a17a71f4846223c4637ed1e70adf1221ba99d6b422ce1a5480c2f167b", + "installation.md": "1384821f2c5069cfa2b6f51445aba7fc10c021ea3215e32c47afbfb207180416", "introduction.md": "06bf96d164d402d4e376c6308b20f96d324110b2e0cf96c2a1a67b39906072e3", - "laravel-adoption.md": "8974d4906658a0727a185ba3d53bf03e8e33494cd63d84def0b9ae62fcc7507e", + "laravel-adoption.md": "55a4df64436667b9477c9a39dd69ddde9f4c30739ba3dfd2ff316b553a55ba4f", "mcp-workflows.md": "1c0b5bb7f2e5c7ca835dfdfa57bbe8f6624172c855f4e225057ac2377abf360e", "migration.md": "7304a53786d5e45d3a639c33386e6558e855ee77982883a5e051ef5084b8453b", "monitoring.md": "346b8a5207b7d69cea63dc9bfec95bf1911d3038a9d30ad06939b13130079279", @@ -102,9 +102,9 @@ "polyglot/worker-compatibility-routing.md": "ef58f23c112f0e6b968927ba861177903adca21ed33b6b9371681e23a18b2994", "polyglot/worker-protocol.md": "91b18b39d626c1288bfa3f6b8212fa8246aa14393cb489a39fe90379bc4cd4b2", "polyglot/workflow-streams.md": "5675a8ea1b9d0b1f7223fecb90b3b048d3006670bf505950bc783709287a6432", - "quickstart.md": "887c6b500e17d41e6098f97f62e07ab3f2a05cd94e36aed93bf05fcce7b532e2", + "quickstart.md": "744ad91ea47202d056e14f6582dd751c471d329433565bcc4cb4182ae4cc76fb", "rolling-upgrades.md": "6acff017f2148d4f7553ebd4811aff8bde59cf6da4251845f4240ef7d1b1a970", - "sample-app.md": "d9cfd76ef3830c9a945949f2b7ca720e6434dbb15dcea96749c01f7e688534db", + "sample-app.md": "0a5e7c704344750c49dccac5e1be058471a70ad2dc68f82bf3920dee30e08cde", "sdk-neutrality.md": "7b0714c123ade4904591870fc20e9a797da1e5485b2a6c87ca3eaa00c5de6ed6", "sponsors.md": "e85e14375743ca8fa50e3a48f894b160e28272573aa88480064f74010ebee98a", "support.md": "706807b3902599dda6080f632ec1f893017ea18bbe9585f533dcdbd6d85f4621", diff --git a/i18n/uk/docusaurus-plugin-content-docs/current/configuration/microservices.md b/i18n/uk/docusaurus-plugin-content-docs/current/configuration/microservices.md index a68dfb979a9..37413257796 100644 --- a/i18n/uk/docusaurus-plugin-content-docs/current/configuration/microservices.md +++ b/i18n/uk/docusaurus-plugin-content-docs/current/configuration/microservices.md @@ -135,6 +135,8 @@ php artisan queue:work shared --queue=workflows php artisan queue:work shared --queue=activities ``` -Worker застосунку A відтворює workflow та планує завдання activity. Worker -застосунку B отримує ці завдання, виконує їх і повертає результати. Рушій -координує передавання через спільну базу даних. +Worker застосунку A відтворює workflow та планує завдання activity. Налаштуйте +його тайм-аут job, як описано в розділі +[Тайм-аут worker](/docs/installation/#worker-timeout). Worker застосунку B +отримує ці завдання, виконує їх і повертає результати. Рушій координує +передавання через спільну базу даних. diff --git a/i18n/uk/docusaurus-plugin-content-docs/current/installation.md b/i18n/uk/docusaurus-plugin-content-docs/current/installation.md index ed3740ce48c..3d0d2249235 100644 --- a/i18n/uk/docusaurus-plugin-content-docs/current/installation.md +++ b/i18n/uk/docusaurus-plugin-content-docs/current/installation.md @@ -70,3 +70,22 @@ activity. Потрібно запустити `queue:work` або скористатися [Horizon](https://laravel.com/docs/12.x/horizon) для запуску worker черги. Без worker черги workflow та activity не оброблятимуться. Для паралельного виконання потрібно кілька worker черги. + +### Тайм-аут worker {#worker-timeout} + +```bash +php artisan queue:work --timeout=0 +``` + +Коли PHP має розширення `pcntl`, `queue:work` примусово завершує будь-який job +черги, що виконується довше за `--timeout` секунд (типово 60). Зміни завдання +workflow, завершеного в такий спосіб, відкочуються. Завдання буде повторено +після спливання оренди завдання workflow (типово 300 секунд), і повторна спроба +виконає ту саму роботу ще раз. Завдання workflow, якому завжди потрібно більше +часу, ніж дозволяє тайм-аут, наприклад завдання, що планує або завершує широкий +`all()`, ніколи не завершиться. + +Запускайте worker для workflow з `--timeout=0` або зі значенням, більшим за +тривалість вашого найдовшого завдання workflow. Тримайте +`workflows.v2.workflow_task_lease_seconds` вищим за це значення. У Horizon +параметр `timeout` супервізора є тим самим налаштуванням. diff --git a/i18n/uk/docusaurus-plugin-content-docs/current/laravel-adoption.md b/i18n/uk/docusaurus-plugin-content-docs/current/laravel-adoption.md index bae2a164fdf..82d94570389 100644 --- a/i18n/uk/docusaurus-plugin-content-docs/current/laravel-adoption.md +++ b/i18n/uk/docusaurus-plugin-content-docs/current/laravel-adoption.md @@ -304,6 +304,9 @@ final class StartOrderFulfillment php artisan queue:work redis --queue=orders ``` +Налаштуйте тайм-аут job для цього worker, як описано в розділі +[Тайм-аут worker](/docs/installation/#worker-timeout). + Використовуйте embedded fake через ту саму дію застосунку. Він безпосередньо виконує готові завдання workflow і записує відправлення activity: diff --git a/i18n/uk/docusaurus-plugin-content-docs/current/quickstart.md b/i18n/uk/docusaurus-plugin-content-docs/current/quickstart.md index a227e79cebd..eedc24ed173 100644 --- a/i18n/uk/docusaurus-plugin-content-docs/current/quickstart.md +++ b/i18n/uk/docusaurus-plugin-content-docs/current/quickstart.md @@ -456,6 +456,9 @@ php artisan migrate php artisan queue:work ``` +Перед запуском широких розгалужень налаштуйте тайм-аут job для worker, як +описано в розділі [Тайм-аут worker](/docs/installation/#worker-timeout). + Для UI оператора в тому самому Laravel-застосунку додайте перевірений вбудований пакет Waterline Composer: diff --git a/i18n/uk/docusaurus-plugin-content-docs/current/sample-app.md b/i18n/uk/docusaurus-plugin-content-docs/current/sample-app.md index 633a6cf021c..378e22cd79d 100644 --- a/i18n/uk/docusaurus-plugin-content-docs/current/sample-app.md +++ b/i18n/uk/docusaurus-plugin-content-docs/current/sample-app.md @@ -126,6 +126,9 @@ Waterline готові після звичайного встановлення. php artisan queue:work ``` +У власному застосунку налаштуйте тайм-аут job для worker, як описано в розділі +[Тайм-аут worker](/docs/installation/#worker-timeout). + Для перевірки самого циклу відновлення без очікування наступного циклу `Looping` зайнятого worker виконайте один явний прохід відновлення з другого термінала: diff --git a/i18n/uk/source-hashes.json b/i18n/uk/source-hashes.json index 3be9b470028..03fa661e095 100644 --- a/i18n/uk/source-hashes.json +++ b/i18n/uk/source-hashes.json @@ -8,7 +8,7 @@ "configuration/customization-matrix.md": "3d115863eaee7852b541bcd01615f424cc19c5847c7cd7d75e5ae63bc3f5cc78", "configuration/database-connection.md": "cc83ae77133236309506fa44d39bfd0c939c32a6154c0bd6099bc64c83bdaec9", "configuration/ensuring-same-server.md": "6c665f37cc198c7b1a775a60a94aab5ff4e55383385e76f1834c7840559b512a", - "configuration/microservices.md": "46dc4afa07588b78829a7e3d259177ce0cf40861f0e31b88dbb6de3a83aa5488", + "configuration/microservices.md": "7421f8f18b62bc326601e2670ba15ba45fb02056da0d70e94ef89b3870f79cb0", "configuration/options.md": "d5079c5059aaa1072693ac09b3b8ea2be9176279820459370e5ebe6660d9f43b", "configuration/pruning-workflows.md": "6f6ee2be3bd185ffec764e86c3ed3cbd40c45f75d28671b4cd11226493e11afb", "configuration/publishing-config.md": "c757acd749c0d2696a6e19484249c9298dd15970ce0cf2ae0e6d2dfd82c8b6d6", @@ -60,9 +60,9 @@ "features/webhooks.md": "edcdfc05ccb0d34a77c51594f85bc3cab343e787f8e0e08d2cd4ddebd048e8c8", "features/worker-sessions.md": "5065368fb5b93599dbd08d97cb9ac312576eb42fee14f081db663aa9f78fb68c", "how-it-works.md": "90454c37f4244297d5c11bcc59549859acf59f88d15ecd26f0a6951c115f86eb", - "installation.md": "895d390a17a71f4846223c4637ed1e70adf1221ba99d6b422ce1a5480c2f167b", + "installation.md": "1384821f2c5069cfa2b6f51445aba7fc10c021ea3215e32c47afbfb207180416", "introduction.md": "06bf96d164d402d4e376c6308b20f96d324110b2e0cf96c2a1a67b39906072e3", - "laravel-adoption.md": "8974d4906658a0727a185ba3d53bf03e8e33494cd63d84def0b9ae62fcc7507e", + "laravel-adoption.md": "55a4df64436667b9477c9a39dd69ddde9f4c30739ba3dfd2ff316b553a55ba4f", "mcp-workflows.md": "1c0b5bb7f2e5c7ca835dfdfa57bbe8f6624172c855f4e225057ac2377abf360e", "migration.md": "7304a53786d5e45d3a639c33386e6558e855ee77982883a5e051ef5084b8453b", "monitoring.md": "346b8a5207b7d69cea63dc9bfec95bf1911d3038a9d30ad06939b13130079279", @@ -102,9 +102,9 @@ "polyglot/worker-compatibility-routing.md": "ef58f23c112f0e6b968927ba861177903adca21ed33b6b9371681e23a18b2994", "polyglot/worker-protocol.md": "91b18b39d626c1288bfa3f6b8212fa8246aa14393cb489a39fe90379bc4cd4b2", "polyglot/workflow-streams.md": "5675a8ea1b9d0b1f7223fecb90b3b048d3006670bf505950bc783709287a6432", - "quickstart.md": "887c6b500e17d41e6098f97f62e07ab3f2a05cd94e36aed93bf05fcce7b532e2", + "quickstart.md": "744ad91ea47202d056e14f6582dd751c471d329433565bcc4cb4182ae4cc76fb", "rolling-upgrades.md": "6acff017f2148d4f7553ebd4811aff8bde59cf6da4251845f4240ef7d1b1a970", - "sample-app.md": "d9cfd76ef3830c9a945949f2b7ca720e6434dbb15dcea96749c01f7e688534db", + "sample-app.md": "0a5e7c704344750c49dccac5e1be058471a70ad2dc68f82bf3920dee30e08cde", "sdk-neutrality.md": "7b0714c123ade4904591870fc20e9a797da1e5485b2a6c87ca3eaa00c5de6ed6", "sponsors.md": "e85e14375743ca8fa50e3a48f894b160e28272573aa88480064f74010ebee98a", "support.md": "706807b3902599dda6080f632ec1f893017ea18bbe9585f533dcdbd6d85f4621", diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/configuration/microservices.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/configuration/microservices.md index 21bf23c2b27..56566a0c32c 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/configuration/microservices.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/configuration/microservices.md @@ -131,4 +131,4 @@ php artisan queue:work shared --queue=workflows php artisan queue:work shared --queue=activities ``` -应用 A 的 Worker 重放工作流并调度活动任务。应用 B 的 Worker 获取这些活动任务、执行并返回结果。引擎通过共享数据库完成交接。 +应用 A 的 Worker 重放工作流并调度活动任务。请按照[Worker 超时](/docs/installation/#worker-timeout)中的说明设置它的作业超时。应用 B 的 Worker 获取这些活动任务、执行并返回结果。引擎通过共享数据库完成交接。 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/installation.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/installation.md index 2b64d00c1cb..79deb6728f1 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/installation.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/installation.md @@ -52,3 +52,13 @@ php artisan migrate ## 运行 Worker {#running-workers} Durable Workflow 使用队列在后台执行工作流和活动。运行 [`queue:work` 命令](https://laravel.com/docs/12.x/queues#the-queue-work-command),或通过 [Horizon](https://laravel.com/docs/12.x/horizon)管理队列 Worker。没有队列 Worker,工作流和活动就不会被处理。并行执行工作流和活动需要多个队列 Worker。 + +### Worker 超时 {#worker-timeout} + +```bash +php artisan queue:work --timeout=0 +``` + +当 PHP 启用了 `pcntl` 扩展时,`queue:work` 会终止运行时间超过 `--timeout` 秒的任何作业,默认值为 60。以这种方式被终止的工作流任务会被回滚。它会在工作流任务租约到期(默认 300 秒)后重试,而重试会重复同样的工作。始终需要比超时更长时间的工作流任务(例如调度或完成一个大规模 `all()` 的任务)永远无法完成。 + +运行工作流 Worker 时请使用 `--timeout=0`,或使用大于最长工作流任务耗时的值。让 `workflows.v2.workflow_task_lease_seconds` 保持大于该值。在 Horizon 中,supervisor 的 `timeout` 选项就是同一个设置。 diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/laravel-adoption.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/laravel-adoption.md index 3f763634656..b28b5c67817 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/laravel-adoption.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/laravel-adoption.md @@ -266,6 +266,8 @@ final class StartOrderFulfillment php artisan queue:work redis --queue=orders ``` +请按照[Worker 超时](/docs/installation/#worker-timeout)中的说明设置此 Worker 的作业超时。 + 通过同一个应用操作使用嵌入式 fake。它内联执行就绪工作流任务并记录活动分发: diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/quickstart.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/quickstart.md index a4150728933..f250be42f66 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/quickstart.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/quickstart.md @@ -411,6 +411,8 @@ php artisan migrate php artisan queue:work ``` +运行大规模扇出之前,请按照[Worker 超时](/docs/installation/#worker-timeout)中的说明设置 Worker 的作业超时。 + 如果需要在同一个 Laravel 应用中使用操作界面,再添加经过验证的 Waterline 内嵌 Composer 包: ```bash diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/sample-app.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/sample-app.md index ec147148b7f..0f2131d1832 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/sample-app.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/sample-app.md @@ -105,6 +105,8 @@ php artisan app:init php artisan queue:work ``` +在你自己的应用中,请按照[Worker 超时](/docs/installation/#worker-timeout)中的说明设置 Worker 的作业超时。 + 若要验证修复循环本身,而不等待繁忙队列 Worker 进入下一个 `Looping` 周期,在第二个终端中明确执行一次恢复扫描: ```bash diff --git a/i18n/zh-Hans/source-hashes.json b/i18n/zh-Hans/source-hashes.json index 3be9b470028..03fa661e095 100644 --- a/i18n/zh-Hans/source-hashes.json +++ b/i18n/zh-Hans/source-hashes.json @@ -8,7 +8,7 @@ "configuration/customization-matrix.md": "3d115863eaee7852b541bcd01615f424cc19c5847c7cd7d75e5ae63bc3f5cc78", "configuration/database-connection.md": "cc83ae77133236309506fa44d39bfd0c939c32a6154c0bd6099bc64c83bdaec9", "configuration/ensuring-same-server.md": "6c665f37cc198c7b1a775a60a94aab5ff4e55383385e76f1834c7840559b512a", - "configuration/microservices.md": "46dc4afa07588b78829a7e3d259177ce0cf40861f0e31b88dbb6de3a83aa5488", + "configuration/microservices.md": "7421f8f18b62bc326601e2670ba15ba45fb02056da0d70e94ef89b3870f79cb0", "configuration/options.md": "d5079c5059aaa1072693ac09b3b8ea2be9176279820459370e5ebe6660d9f43b", "configuration/pruning-workflows.md": "6f6ee2be3bd185ffec764e86c3ed3cbd40c45f75d28671b4cd11226493e11afb", "configuration/publishing-config.md": "c757acd749c0d2696a6e19484249c9298dd15970ce0cf2ae0e6d2dfd82c8b6d6", @@ -60,9 +60,9 @@ "features/webhooks.md": "edcdfc05ccb0d34a77c51594f85bc3cab343e787f8e0e08d2cd4ddebd048e8c8", "features/worker-sessions.md": "5065368fb5b93599dbd08d97cb9ac312576eb42fee14f081db663aa9f78fb68c", "how-it-works.md": "90454c37f4244297d5c11bcc59549859acf59f88d15ecd26f0a6951c115f86eb", - "installation.md": "895d390a17a71f4846223c4637ed1e70adf1221ba99d6b422ce1a5480c2f167b", + "installation.md": "1384821f2c5069cfa2b6f51445aba7fc10c021ea3215e32c47afbfb207180416", "introduction.md": "06bf96d164d402d4e376c6308b20f96d324110b2e0cf96c2a1a67b39906072e3", - "laravel-adoption.md": "8974d4906658a0727a185ba3d53bf03e8e33494cd63d84def0b9ae62fcc7507e", + "laravel-adoption.md": "55a4df64436667b9477c9a39dd69ddde9f4c30739ba3dfd2ff316b553a55ba4f", "mcp-workflows.md": "1c0b5bb7f2e5c7ca835dfdfa57bbe8f6624172c855f4e225057ac2377abf360e", "migration.md": "7304a53786d5e45d3a639c33386e6558e855ee77982883a5e051ef5084b8453b", "monitoring.md": "346b8a5207b7d69cea63dc9bfec95bf1911d3038a9d30ad06939b13130079279", @@ -102,9 +102,9 @@ "polyglot/worker-compatibility-routing.md": "ef58f23c112f0e6b968927ba861177903adca21ed33b6b9371681e23a18b2994", "polyglot/worker-protocol.md": "91b18b39d626c1288bfa3f6b8212fa8246aa14393cb489a39fe90379bc4cd4b2", "polyglot/workflow-streams.md": "5675a8ea1b9d0b1f7223fecb90b3b048d3006670bf505950bc783709287a6432", - "quickstart.md": "887c6b500e17d41e6098f97f62e07ab3f2a05cd94e36aed93bf05fcce7b532e2", + "quickstart.md": "744ad91ea47202d056e14f6582dd751c471d329433565bcc4cb4182ae4cc76fb", "rolling-upgrades.md": "6acff017f2148d4f7553ebd4811aff8bde59cf6da4251845f4240ef7d1b1a970", - "sample-app.md": "d9cfd76ef3830c9a945949f2b7ca720e6434dbb15dcea96749c01f7e688534db", + "sample-app.md": "0a5e7c704344750c49dccac5e1be058471a70ad2dc68f82bf3920dee30e08cde", "sdk-neutrality.md": "7b0714c123ade4904591870fc20e9a797da1e5485b2a6c87ca3eaa00c5de6ed6", "sponsors.md": "e85e14375743ca8fa50e3a48f894b160e28272573aa88480064f74010ebee98a", "support.md": "706807b3902599dda6080f632ec1f893017ea18bbe9585f533dcdbd6d85f4621", From a28555e0c2cd351ba29bb6484d8805b2a63d8da5 Mon Sep 17 00:00:00 2001 From: Richard McDaniel <1130888+rmcdaniel@users.noreply.github.com> Date: Thu, 19 Nov 2026 18:08:21 +0000 Subject: [PATCH 3/5] Replace the --timeout=0 advice with a bounded workflow-queue setup A blanket --timeout=0 lets a hung activity hold its worker forever and breaks Laravel's rule that retry_after exceeds every job's timeout. Explain how the workflow task timeout, the task lease and retry_after relate, and recommend a dedicated workflow-task connection (retry_after above the lease, workers with --timeout below it) with activities on a bounded queue. Note that newer releases give workflow task jobs this timeout themselves. Co-Authored-By: Claude Opus 5.5 --- docs/installation.md | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/docs/installation.md b/docs/installation.md index 0f1e55100ca..41ea8fb1933 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -65,10 +65,30 @@ Durable Workflow uses queues to run workflows and activities in the background. ### Worker timeout {#worker-timeout} -```bash -php artisan queue:work --timeout=0 +When PHP has the `pcntl` extension, a queue worker kills any job that runs longer than its timeout: the worker's `--timeout`, 60 seconds by default, unless the job sets its own. A workflow task that is killed loses its lease and is rolled back. It is retried only after the lease expires (`workflows.v2.workflow_task_lease_seconds`, 300 seconds by default), and the retry repeats the same work. A workflow task that always needs longer than the timeout, such as one that schedules or finishes a wide `all()`, never completes. + +Three settings must line up: + +- The **workflow task timeout** must be below the **workflow task lease**. Work that runs past the lease cannot complete. +- The queue connection's **`retry_after`** must exceed the timeout of every job on it, as Laravel requires. Otherwise the queue hands a job that is still running to a second worker. +- **Activities** should keep a bounded timeout, so that a hung activity cannot hold a worker forever. Do not use `--timeout=0`. + +Run workflow tasks on their own queue connection whose `retry_after` exceeds the lease, with workers whose `--timeout` is below the lease. Run activities on another queue with a timeout that suits them. Activities use their workflow's queue unless the activity class sets its own `$connection` or `$queue`. + +```php +// config/queue.php: a connection for workflow tasks +'workflows' => [ + 'driver' => 'redis', + 'connection' => 'default', + 'queue' => 'workflows', + 'retry_after' => 330, // above the 300-second workflow task lease +], ``` -When PHP has the `pcntl` extension, `queue:work` kills any job that runs longer than `--timeout` seconds, which defaults to 60. A workflow task killed this way is rolled back. It is retried after its workflow task lease expires (300 seconds by default), and the retry repeats the same work. A workflow task that always needs longer than the timeout, such as one that schedules or finishes a wide `all()`, never completes. +```bash +# DW_V2_CONNECTION=workflows DW_V2_QUEUE=workflows +php artisan queue:work workflows --queue=workflows --timeout=270 +php artisan queue:work --queue=default --timeout=60 +``` -Run workflow workers with `--timeout=0`, or with a value above your longest workflow task. Keep `workflows.v2.workflow_task_lease_seconds` above that value. In Horizon, the supervisor's `timeout` option is the same setting. +In Horizon, each supervisor's `timeout` option is the worker timeout. Newer Workflow releases give every workflow task job this timeout (the lease less 30 seconds, kept 10 seconds below `retry_after`), so a short worker timeout no longer kills workflow tasks. A worker on the workflow queue logs a warning at start when `retry_after` limits workflow tasks. From 1b7e009aba695d29e938de3e4cc9af9b2daa65ef Mon Sep 17 00:00:00 2001 From: Richard McDaniel <1130888+rmcdaniel@users.noreply.github.com> Date: Thu, 19 Nov 2026 18:10:32 +0000 Subject: [PATCH 4/5] Translate the bounded workflow-queue worker timeout guidance Replace the Worker timeout subsection of Installation in de, es, fr, ja, pt-BR, uk and zh-Hans with a translation of the rewritten English section: how the workflow task timeout, the task lease and retry_after relate, the dedicated workflow-task connection, and the newer-release behaviour. Code blocks and the {#worker-timeout} anchor are unchanged. Record the reviewed English installation.md hash in each locale's source-hashes.json. Co-Authored-By: Claude Opus 5.5 --- .../current/installation.md | 28 +++++++-- i18n/de/source-hashes.json | 2 +- .../current/installation.md | 59 +++++++++++++++---- i18n/es/source-hashes.json | 2 +- .../current/installation.md | 28 +++++++-- i18n/fr/source-hashes.json | 2 +- .../current/installation.md | 28 +++++++-- i18n/ja/source-hashes.json | 2 +- .../current/installation.md | 58 ++++++++++++++---- i18n/pt-BR/source-hashes.json | 2 +- .../current/installation.md | 58 ++++++++++++++---- i18n/uk/source-hashes.json | 2 +- .../current/installation.md | 28 +++++++-- i18n/zh-Hans/source-hashes.json | 2 +- 14 files changed, 240 insertions(+), 61 deletions(-) diff --git a/i18n/de/docusaurus-plugin-content-docs/current/installation.md b/i18n/de/docusaurus-plugin-content-docs/current/installation.md index 58648341ec7..7440ddf26f9 100644 --- a/i18n/de/docusaurus-plugin-content-docs/current/installation.md +++ b/i18n/de/docusaurus-plugin-content-docs/current/installation.md @@ -57,10 +57,30 @@ Durable Workflow führt Workflows und Aktivitäten im Hintergrund über Wartesch ### Worker-Timeout {#worker-timeout} -```bash -php artisan queue:work --timeout=0 +Wenn PHP die Erweiterung `pcntl` hat, beendet ein Queue-Worker jeden Job, der länger als sein Timeout läuft: das `--timeout` des Workers, standardmäßig 60 Sekunden, sofern der Job kein eigenes festlegt. Eine so beendete Workflow-Aufgabe verliert ihre Lease und wird zurückgerollt. Sie wird erst nach Ablauf der Lease erneut versucht (`workflows.v2.workflow_task_lease_seconds`, standardmäßig 300 Sekunden), und der neue Versuch wiederholt dieselbe Arbeit. Eine Workflow-Aufgabe, die immer länger als das Timeout braucht, etwa eine, die ein breites `all()` plant oder abschließt, wird nie abgeschlossen. + +Drei Einstellungen müssen zusammenpassen: + +- Das **Timeout der Workflow-Aufgabe** muss unter der **Lease der Workflow-Aufgabe** liegen. Arbeit, die über die Lease hinaus läuft, kann nicht abgeschlossen werden. +- **`retry_after`** der Queue-Verbindung muss das Timeout jedes Jobs auf dieser Verbindung übersteigen, wie Laravel es verlangt. Andernfalls übergibt die Queue einen noch laufenden Job an einen zweiten Worker. +- **Aktivitäten** sollten ein begrenztes Timeout behalten, damit eine hängende Aktivität einen Worker nicht für immer blockieren kann. Verwenden Sie nicht `--timeout=0`. + +Führen Sie Workflow-Aufgaben auf einer eigenen Queue-Verbindung aus, deren `retry_after` die Lease übersteigt, mit Workern, deren `--timeout` unter der Lease liegt. Führen Sie Aktivitäten auf einer anderen Queue mit einem für sie passenden Timeout aus. Aktivitäten verwenden die Queue ihres Workflows, sofern die Aktivitätsklasse nicht eigene `$connection`- oder `$queue`-Werte festlegt. + +```php +// config/queue.php: a connection for workflow tasks +'workflows' => [ + 'driver' => 'redis', + 'connection' => 'default', + 'queue' => 'workflows', + 'retry_after' => 330, // above the 300-second workflow task lease +], ``` -Wenn PHP die Erweiterung `pcntl` hat, beendet `queue:work` jeden Job, der länger als `--timeout` Sekunden läuft; der Standardwert ist 60. Eine so beendete Workflow-Aufgabe wird zurückgerollt. Sie wird erneut versucht, nachdem ihre Workflow-Aufgaben-Lease abgelaufen ist (standardmäßig 300 Sekunden), und der neue Versuch wiederholt dieselbe Arbeit. Eine Workflow-Aufgabe, die immer länger als das Timeout braucht, etwa eine, die ein breites `all()` plant oder abschließt, wird nie abgeschlossen. +```bash +# DW_V2_CONNECTION=workflows DW_V2_QUEUE=workflows +php artisan queue:work workflows --queue=workflows --timeout=270 +php artisan queue:work --queue=default --timeout=60 +``` -Führen Sie Workflow-Worker mit `--timeout=0` oder mit einem Wert über Ihrer längsten Workflow-Aufgabe aus. Halten Sie `workflows.v2.workflow_task_lease_seconds` über diesem Wert. In Horizon ist die Option `timeout` des Supervisors dieselbe Einstellung. +In Horizon ist die Option `timeout` jedes Supervisors das Worker-Timeout. Neuere Workflow-Releases geben jedem Job einer Workflow-Aufgabe dieses Timeout (die Lease abzüglich 30 Sekunden, mindestens 10 Sekunden unter `retry_after` gehalten), sodass ein kurzes Worker-Timeout Workflow-Aufgaben nicht mehr beendet. Ein Worker auf der Workflow-Queue protokolliert beim Start eine Warnung, wenn `retry_after` Workflow-Aufgaben begrenzt. diff --git a/i18n/de/source-hashes.json b/i18n/de/source-hashes.json index 03fa661e095..61308987006 100644 --- a/i18n/de/source-hashes.json +++ b/i18n/de/source-hashes.json @@ -60,7 +60,7 @@ "features/webhooks.md": "edcdfc05ccb0d34a77c51594f85bc3cab343e787f8e0e08d2cd4ddebd048e8c8", "features/worker-sessions.md": "5065368fb5b93599dbd08d97cb9ac312576eb42fee14f081db663aa9f78fb68c", "how-it-works.md": "90454c37f4244297d5c11bcc59549859acf59f88d15ecd26f0a6951c115f86eb", - "installation.md": "1384821f2c5069cfa2b6f51445aba7fc10c021ea3215e32c47afbfb207180416", + "installation.md": "117ba373ee55eda1ddd3c160985d686ca6b18e242228e3b63ca54869ec3705f9", "introduction.md": "06bf96d164d402d4e376c6308b20f96d324110b2e0cf96c2a1a67b39906072e3", "laravel-adoption.md": "55a4df64436667b9477c9a39dd69ddde9f4c30739ba3dfd2ff316b553a55ba4f", "mcp-workflows.md": "1c0b5bb7f2e5c7ca835dfdfa57bbe8f6624172c855f4e225057ac2377abf360e", diff --git a/i18n/es/docusaurus-plugin-content-docs/current/installation.md b/i18n/es/docusaurus-plugin-content-docs/current/installation.md index d547579be9e..99c0d946380 100644 --- a/i18n/es/docusaurus-plugin-content-docs/current/installation.md +++ b/i18n/es/docusaurus-plugin-content-docs/current/installation.md @@ -71,18 +71,53 @@ procesan. Para ejecutarlos en paralelo, necesitas más de un worker. ### Tiempo límite del worker {#worker-timeout} +Cuando PHP tiene la extensión `pcntl`, un worker de colas termina cualquier job +que se ejecute más allá de su tiempo límite: el `--timeout` del worker, 60 +segundos por defecto, salvo que el job defina el suyo. Una tarea de workflow +terminada así pierde su lease y se revierte. Solo se reintenta cuando vence el +lease (`workflows.v2.workflow_task_lease_seconds`, 300 segundos por defecto), y +el reintento repite el mismo trabajo. Una tarea de workflow que siempre necesita +más tiempo que el límite, como una que programa o termina un `all()` amplio, +nunca se completa. + +Tres ajustes deben encajar: + +- El **tiempo límite de la tarea de workflow** debe ser inferior al + **lease de la tarea de workflow**. El trabajo que se prolonga más allá del + lease no puede completarse. +- El **`retry_after`** de la conexión de cola debe superar el tiempo límite de + cada job que pase por ella, como exige Laravel. De lo contrario, la cola + entrega un job que sigue en ejecución a un segundo worker. +- Las **actividades** deben mantener un tiempo límite acotado, para que una + actividad bloqueada no pueda retener un worker para siempre. No uses + `--timeout=0`. + +Ejecuta las tareas de workflow en su propia conexión de cola, con un +`retry_after` superior al lease y con workers cuyo `--timeout` sea inferior al +lease. Ejecuta las actividades en otra cola con un tiempo límite adecuado para +ellas. Las actividades usan la cola de su workflow, salvo que la clase de la +actividad defina su propio `$connection` o `$queue`. + +```php +// config/queue.php: a connection for workflow tasks +'workflows' => [ + 'driver' => 'redis', + 'connection' => 'default', + 'queue' => 'workflows', + 'retry_after' => 330, // above the 300-second workflow task lease +], +``` + ```bash -php artisan queue:work --timeout=0 +# DW_V2_CONNECTION=workflows DW_V2_QUEUE=workflows +php artisan queue:work workflows --queue=workflows --timeout=270 +php artisan queue:work --queue=default --timeout=60 ``` -Cuando PHP tiene la extensión `pcntl`, `queue:work` termina cualquier job que se -ejecute durante más de `--timeout` segundos, que por defecto son 60. Una tarea -de workflow terminada así se revierte. Se reintenta cuando vence su lease de -tarea de workflow (300 segundos por defecto), y el reintento repite el mismo -trabajo. Una tarea de workflow que siempre necesita más tiempo que el límite, -como una que programa o termina un `all()` amplio, nunca se completa. - -Ejecuta los workers de workflows con `--timeout=0` o con un valor superior a tu -tarea de workflow más larga. Mantén `workflows.v2.workflow_task_lease_seconds` -por encima de ese valor. En Horizon, la opción `timeout` del supervisor es el -mismo ajuste. +En Horizon, la opción `timeout` de cada supervisor es el tiempo límite del +worker. Las versiones más recientes de Workflow asignan este tiempo límite a +cada job de tarea de workflow (el lease menos 30 segundos, mantenido al menos 10 +segundos por debajo de `retry_after`), de modo que un tiempo límite corto del +worker ya no termina las tareas de workflow. Un worker de la cola de workflows +registra una advertencia al iniciarse cuando `retry_after` limita las tareas de +workflow. diff --git a/i18n/es/source-hashes.json b/i18n/es/source-hashes.json index 03fa661e095..61308987006 100644 --- a/i18n/es/source-hashes.json +++ b/i18n/es/source-hashes.json @@ -60,7 +60,7 @@ "features/webhooks.md": "edcdfc05ccb0d34a77c51594f85bc3cab343e787f8e0e08d2cd4ddebd048e8c8", "features/worker-sessions.md": "5065368fb5b93599dbd08d97cb9ac312576eb42fee14f081db663aa9f78fb68c", "how-it-works.md": "90454c37f4244297d5c11bcc59549859acf59f88d15ecd26f0a6951c115f86eb", - "installation.md": "1384821f2c5069cfa2b6f51445aba7fc10c021ea3215e32c47afbfb207180416", + "installation.md": "117ba373ee55eda1ddd3c160985d686ca6b18e242228e3b63ca54869ec3705f9", "introduction.md": "06bf96d164d402d4e376c6308b20f96d324110b2e0cf96c2a1a67b39906072e3", "laravel-adoption.md": "55a4df64436667b9477c9a39dd69ddde9f4c30739ba3dfd2ff316b553a55ba4f", "mcp-workflows.md": "1c0b5bb7f2e5c7ca835dfdfa57bbe8f6624172c855f4e225057ac2377abf360e", diff --git a/i18n/fr/docusaurus-plugin-content-docs/current/installation.md b/i18n/fr/docusaurus-plugin-content-docs/current/installation.md index 730d4adbd24..f74b1ff4004 100644 --- a/i18n/fr/docusaurus-plugin-content-docs/current/installation.md +++ b/i18n/fr/docusaurus-plugin-content-docs/current/installation.md @@ -57,10 +57,30 @@ Durable Workflow utilise des files pour exécuter les workflows et les activité ### Délai d’expiration du worker {#worker-timeout} -```bash -php artisan queue:work --timeout=0 +Lorsque PHP dispose de l’extension `pcntl`, un worker de file tue tout job qui s’exécute au-delà de son délai d’expiration : le `--timeout` du worker, 60 secondes par défaut, sauf si le job définit le sien. Une tâche de workflow tuée perd son bail et ses changements sont annulés. Elle n’est relancée qu’après l’expiration du bail (`workflows.v2.workflow_task_lease_seconds`, 300 secondes par défaut), et la nouvelle tentative refait le même travail. Une tâche de workflow qui a toujours besoin de plus de temps que ce délai, par exemple une tâche qui planifie ou termine un large `all()`, ne se termine jamais. + +Trois réglages doivent être cohérents : + +- Le **délai d’expiration de la tâche de workflow** doit être inférieur au **bail de la tâche de workflow**. Un travail qui dépasse le bail ne peut pas se terminer. +- Le **`retry_after`** de la connexion de file doit dépasser le délai d’expiration de chaque job qu’elle transporte, comme l’exige Laravel. Sinon, la file confie un job encore en cours à un second worker. +- Les **activités** doivent garder un délai d’expiration borné, afin qu’une activité bloquée ne puisse pas occuper un worker indéfiniment. N’utilisez pas `--timeout=0`. + +Exécutez les tâches de workflow sur leur propre connexion de file, dont le `retry_after` dépasse le bail, avec des workers dont le `--timeout` est inférieur au bail. Exécutez les activités sur une autre file avec un délai d’expiration qui leur convient. Les activités utilisent la file de leur workflow, sauf si la classe d’activité définit ses propres `$connection` ou `$queue`. + +```php +// config/queue.php: a connection for workflow tasks +'workflows' => [ + 'driver' => 'redis', + 'connection' => 'default', + 'queue' => 'workflows', + 'retry_after' => 330, // above the 300-second workflow task lease +], ``` -Lorsque PHP dispose de l’extension `pcntl`, `queue:work` tue tout job qui s’exécute plus de `--timeout` secondes, 60 par défaut. Les changements d’une tâche de workflow tuée de cette façon sont annulés. Elle est relancée après l’expiration de son bail de tâche de workflow (300 secondes par défaut), et la nouvelle tentative refait le même travail. Une tâche de workflow qui a toujours besoin de plus de temps que ce délai, par exemple une tâche qui planifie ou termine un large `all()`, ne se termine jamais. +```bash +# DW_V2_CONNECTION=workflows DW_V2_QUEUE=workflows +php artisan queue:work workflows --queue=workflows --timeout=270 +php artisan queue:work --queue=default --timeout=60 +``` -Exécutez les workers de workflow avec `--timeout=0`, ou avec une valeur supérieure à votre plus longue tâche de workflow. Gardez `workflows.v2.workflow_task_lease_seconds` au-dessus de cette valeur. Dans Horizon, l’option `timeout` du superviseur est le même réglage. +Dans Horizon, l’option `timeout` de chaque superviseur est le délai d’expiration du worker. Les versions plus récentes de Workflow attribuent ce délai à chaque job de tâche de workflow (le bail moins 30 secondes, maintenu au moins 10 secondes sous `retry_after`), si bien qu’un délai court du worker ne tue plus les tâches de workflow. Un worker de la file des workflows journalise un avertissement au démarrage lorsque `retry_after` limite les tâches de workflow. diff --git a/i18n/fr/source-hashes.json b/i18n/fr/source-hashes.json index 03fa661e095..61308987006 100644 --- a/i18n/fr/source-hashes.json +++ b/i18n/fr/source-hashes.json @@ -60,7 +60,7 @@ "features/webhooks.md": "edcdfc05ccb0d34a77c51594f85bc3cab343e787f8e0e08d2cd4ddebd048e8c8", "features/worker-sessions.md": "5065368fb5b93599dbd08d97cb9ac312576eb42fee14f081db663aa9f78fb68c", "how-it-works.md": "90454c37f4244297d5c11bcc59549859acf59f88d15ecd26f0a6951c115f86eb", - "installation.md": "1384821f2c5069cfa2b6f51445aba7fc10c021ea3215e32c47afbfb207180416", + "installation.md": "117ba373ee55eda1ddd3c160985d686ca6b18e242228e3b63ca54869ec3705f9", "introduction.md": "06bf96d164d402d4e376c6308b20f96d324110b2e0cf96c2a1a67b39906072e3", "laravel-adoption.md": "55a4df64436667b9477c9a39dd69ddde9f4c30739ba3dfd2ff316b553a55ba4f", "mcp-workflows.md": "1c0b5bb7f2e5c7ca835dfdfa57bbe8f6624172c855f4e225057ac2377abf360e", diff --git a/i18n/ja/docusaurus-plugin-content-docs/current/installation.md b/i18n/ja/docusaurus-plugin-content-docs/current/installation.md index 1a779c92734..d7ff5313712 100644 --- a/i18n/ja/docusaurus-plugin-content-docs/current/installation.md +++ b/i18n/ja/docusaurus-plugin-content-docs/current/installation.md @@ -56,10 +56,30 @@ Durable Workflow はキューを使って、ワークフローとアクティビ ### Worker のタイムアウト {#worker-timeout} -```bash -php artisan queue:work --timeout=0 +PHP に `pcntl` 拡張がある場合、キュー Worker はタイムアウトを超えて実行されたジョブを強制終了します。タイムアウトは Worker の `--timeout`(デフォルトは 60 秒)で、ジョブが独自に設定している場合はその値です。強制終了されたワークフロータスクはリースを失い、ロールバックされます。再試行はリースの期限(`workflows.v2.workflow_task_lease_seconds`、デフォルトは 300 秒)が切れた後にしか行われず、再試行では同じ作業が繰り返されます。幅の広い `all()` をスケジュールまたは完了するタスクのように、常にタイムアウトより長い時間を必要とするワークフロータスクは、いつまでも完了しません。 + +次の三つの設定を揃える必要があります。 + +- **ワークフロータスクのタイムアウト**は**ワークフロータスクのリース**より短くしなければなりません。リースを超えて実行される作業は完了できません。 +- キュー接続の **`retry_after`** は、Laravel が求めるとおり、その接続上のすべてのジョブのタイムアウトより長くしなければなりません。そうでないと、キューはまだ実行中のジョブを別の Worker に渡してしまいます。 +- **アクティビティ**には上限のあるタイムアウトを残し、ハングしたアクティビティが Worker を永久に占有できないようにしてください。`--timeout=0` は使わないでください。 + +ワークフロータスクは専用のキュー接続で実行し、その接続の `retry_after` をリースより長く、Worker の `--timeout` をリースより短くしてください。アクティビティは、それに合ったタイムアウトを設定した別のキューで実行してください。アクティビティクラスが独自の `$connection` または `$queue` を設定していない限り、アクティビティはワークフローのキューを使います。 + +```php +// config/queue.php: a connection for workflow tasks +'workflows' => [ + 'driver' => 'redis', + 'connection' => 'default', + 'queue' => 'workflows', + 'retry_after' => 330, // above the 300-second workflow task lease +], ``` -PHP に `pcntl` 拡張がある場合、`queue:work` は `--timeout` 秒(デフォルトは 60)を超えて実行されたジョブを強制終了します。こうして強制終了されたワークフロータスクはロールバックされます。そのタスクはワークフロータスクのリース(デフォルトは 300 秒)の期限が切れた後に再試行され、再試行では同じ作業が繰り返されます。幅の広い `all()` をスケジュールまたは完了するタスクのように、常にタイムアウトより長い時間を必要とするワークフロータスクは、いつまでも完了しません。 +```bash +# DW_V2_CONNECTION=workflows DW_V2_QUEUE=workflows +php artisan queue:work workflows --queue=workflows --timeout=270 +php artisan queue:work --queue=default --timeout=60 +``` -ワークフロー Worker は `--timeout=0`、または最も長いワークフロータスクを上回る値で実行してください。`workflows.v2.workflow_task_lease_seconds` はその値より大きく保ってください。Horizon では、supervisor の `timeout` オプションが同じ設定です。 +Horizon では、各 supervisor の `timeout` オプションが Worker のタイムアウトです。新しい Workflow リリースでは、すべてのワークフロータスクのジョブにこのタイムアウト(リースから 30 秒を引いた値で、`retry_after` より少なくとも 10 秒短く保たれます)が設定されるため、短い Worker タイムアウトでワークフロータスクが強制終了されることはなくなります。ワークフローキューの Worker は、`retry_after` がワークフロータスクを制限している場合、起動時に警告をログに出力します。 diff --git a/i18n/ja/source-hashes.json b/i18n/ja/source-hashes.json index 03fa661e095..61308987006 100644 --- a/i18n/ja/source-hashes.json +++ b/i18n/ja/source-hashes.json @@ -60,7 +60,7 @@ "features/webhooks.md": "edcdfc05ccb0d34a77c51594f85bc3cab343e787f8e0e08d2cd4ddebd048e8c8", "features/worker-sessions.md": "5065368fb5b93599dbd08d97cb9ac312576eb42fee14f081db663aa9f78fb68c", "how-it-works.md": "90454c37f4244297d5c11bcc59549859acf59f88d15ecd26f0a6951c115f86eb", - "installation.md": "1384821f2c5069cfa2b6f51445aba7fc10c021ea3215e32c47afbfb207180416", + "installation.md": "117ba373ee55eda1ddd3c160985d686ca6b18e242228e3b63ca54869ec3705f9", "introduction.md": "06bf96d164d402d4e376c6308b20f96d324110b2e0cf96c2a1a67b39906072e3", "laravel-adoption.md": "55a4df64436667b9477c9a39dd69ddde9f4c30739ba3dfd2ff316b553a55ba4f", "mcp-workflows.md": "1c0b5bb7f2e5c7ca835dfdfa57bbe8f6624172c855f4e225057ac2377abf360e", diff --git a/i18n/pt-BR/docusaurus-plugin-content-docs/current/installation.md b/i18n/pt-BR/docusaurus-plugin-content-docs/current/installation.md index 74a71d7af24..cb660465afc 100644 --- a/i18n/pt-BR/docusaurus-plugin-content-docs/current/installation.md +++ b/i18n/pt-BR/docusaurus-plugin-content-docs/current/installation.md @@ -73,19 +73,51 @@ executá-los em paralelo, você precisa de mais de um worker de fila. ### Timeout do worker {#worker-timeout} +Quando o PHP tem a extensão `pcntl`, um worker de fila encerra qualquer job que +rode além do seu timeout: o `--timeout` do worker, 60 segundos por padrão, a +menos que o job defina o próprio. Uma tarefa de workflow encerrada dessa forma +perde o lease e sofre rollback. Ela só é tentada novamente depois que o lease +expira (`workflows.v2.workflow_task_lease_seconds`, 300 segundos por padrão), e +a nova tentativa repete o mesmo trabalho. Uma tarefa de workflow que sempre +precisa de mais tempo que o timeout, como uma que agenda ou conclui um `all()` +amplo, nunca é concluída. + +Três configurações precisam estar alinhadas: + +- O **timeout da tarefa de workflow** precisa ficar abaixo do + **lease da tarefa de workflow**. Trabalho que ultrapassa o lease não consegue + ser concluído. +- O **`retry_after`** da conexão de fila precisa exceder o timeout de todos os + jobs nela, como o Laravel exige. Caso contrário, a fila entrega um job ainda + em execução a um segundo worker. +- As **atividades** devem manter um timeout limitado, para que uma atividade + travada não prenda um worker para sempre. Não use `--timeout=0`. + +Execute as tarefas de workflow em uma conexão de fila própria, cujo +`retry_after` exceda o lease, com workers cujo `--timeout` fique abaixo do +lease. Execute as atividades em outra fila, com um timeout adequado a elas. As +atividades usam a fila do seu workflow, a menos que a classe da atividade defina +seu próprio `$connection` ou `$queue`. + +```php +// config/queue.php: a connection for workflow tasks +'workflows' => [ + 'driver' => 'redis', + 'connection' => 'default', + 'queue' => 'workflows', + 'retry_after' => 330, // above the 300-second workflow task lease +], +``` + ```bash -php artisan queue:work --timeout=0 +# DW_V2_CONNECTION=workflows DW_V2_QUEUE=workflows +php artisan queue:work workflows --queue=workflows --timeout=270 +php artisan queue:work --queue=default --timeout=60 ``` -Quando o PHP tem a extensão `pcntl`, o `queue:work` encerra qualquer job que -rode por mais de `--timeout` segundos, que por padrão são 60. Uma tarefa de -workflow encerrada dessa forma sofre rollback. Ela é tentada novamente depois -que o lease da tarefa de workflow expira (300 segundos por padrão), e a nova -tentativa repete o mesmo trabalho. Uma tarefa de workflow que sempre precisa de -mais tempo que o timeout, como uma que agenda ou conclui um `all()` amplo, nunca -é concluída. - -Execute os workers de workflow com `--timeout=0` ou com um valor acima da sua -tarefa de workflow mais longa. Mantenha -`workflows.v2.workflow_task_lease_seconds` acima desse valor. No Horizon, a -opção `timeout` do supervisor é a mesma configuração. +No Horizon, a opção `timeout` de cada supervisor é o timeout do worker. Versões +mais recentes do Workflow aplicam esse timeout a todo job de tarefa de workflow +(o lease menos 30 segundos, mantido pelo menos 10 segundos abaixo de +`retry_after`), de modo que um timeout curto do worker não encerra mais tarefas +de workflow. Um worker da fila de workflows registra um aviso ao iniciar quando +`retry_after` limita as tarefas de workflow. diff --git a/i18n/pt-BR/source-hashes.json b/i18n/pt-BR/source-hashes.json index 03fa661e095..61308987006 100644 --- a/i18n/pt-BR/source-hashes.json +++ b/i18n/pt-BR/source-hashes.json @@ -60,7 +60,7 @@ "features/webhooks.md": "edcdfc05ccb0d34a77c51594f85bc3cab343e787f8e0e08d2cd4ddebd048e8c8", "features/worker-sessions.md": "5065368fb5b93599dbd08d97cb9ac312576eb42fee14f081db663aa9f78fb68c", "how-it-works.md": "90454c37f4244297d5c11bcc59549859acf59f88d15ecd26f0a6951c115f86eb", - "installation.md": "1384821f2c5069cfa2b6f51445aba7fc10c021ea3215e32c47afbfb207180416", + "installation.md": "117ba373ee55eda1ddd3c160985d686ca6b18e242228e3b63ca54869ec3705f9", "introduction.md": "06bf96d164d402d4e376c6308b20f96d324110b2e0cf96c2a1a67b39906072e3", "laravel-adoption.md": "55a4df64436667b9477c9a39dd69ddde9f4c30739ba3dfd2ff316b553a55ba4f", "mcp-workflows.md": "1c0b5bb7f2e5c7ca835dfdfa57bbe8f6624172c855f4e225057ac2377abf360e", diff --git a/i18n/uk/docusaurus-plugin-content-docs/current/installation.md b/i18n/uk/docusaurus-plugin-content-docs/current/installation.md index 3d0d2249235..815ab9f516b 100644 --- a/i18n/uk/docusaurus-plugin-content-docs/current/installation.md +++ b/i18n/uk/docusaurus-plugin-content-docs/current/installation.md @@ -73,19 +73,51 @@ activity. Потрібно запустити ### Тайм-аут worker {#worker-timeout} +Коли PHP має розширення `pcntl`, worker черги примусово завершує будь-який job, +що виконується довше за свій тайм-аут: `--timeout` worker, типово 60 секунд, +якщо job не задає власний. Завдання workflow, завершене в такий спосіб, втрачає +оренду, а його зміни відкочуються. Його буде повторено лише після спливання +оренди (`workflows.v2.workflow_task_lease_seconds`, типово 300 секунд), і +повторна спроба виконає ту саму роботу ще раз. Завдання workflow, якому завжди +потрібно більше часу, ніж дозволяє тайм-аут, наприклад завдання, що планує або +завершує широкий `all()`, ніколи не завершиться. + +Три налаштування мають узгоджуватися: + +- **Тайм-аут завдання workflow** має бути меншим за + **оренду завдання workflow**. Робота, що триває довше за оренду, не може + завершитися. +- **`retry_after`** з’єднання черги має перевищувати тайм-аут кожного job у + цьому з’єднанні, як вимагає Laravel. Інакше черга передасть job, що ще + виконується, другому worker. +- **Activity** мають зберігати обмежений тайм-аут, щоб завислий activity не міг + утримувати worker назавжди. Не використовуйте `--timeout=0`. + +Запускайте завдання workflow в окремому з’єднанні черги, у якого `retry_after` +перевищує оренду, з worker, чий `--timeout` менший за оренду. Запускайте +activity в іншій черзі з тайм-аутом, що їм підходить. Activity використовують +чергу свого workflow, якщо клас activity не задає власні `$connection` або +`$queue`. + +```php +// config/queue.php: a connection for workflow tasks +'workflows' => [ + 'driver' => 'redis', + 'connection' => 'default', + 'queue' => 'workflows', + 'retry_after' => 330, // above the 300-second workflow task lease +], +``` + ```bash -php artisan queue:work --timeout=0 +# DW_V2_CONNECTION=workflows DW_V2_QUEUE=workflows +php artisan queue:work workflows --queue=workflows --timeout=270 +php artisan queue:work --queue=default --timeout=60 ``` -Коли PHP має розширення `pcntl`, `queue:work` примусово завершує будь-який job -черги, що виконується довше за `--timeout` секунд (типово 60). Зміни завдання -workflow, завершеного в такий спосіб, відкочуються. Завдання буде повторено -після спливання оренди завдання workflow (типово 300 секунд), і повторна спроба -виконає ту саму роботу ще раз. Завдання workflow, якому завжди потрібно більше -часу, ніж дозволяє тайм-аут, наприклад завдання, що планує або завершує широкий -`all()`, ніколи не завершиться. - -Запускайте worker для workflow з `--timeout=0` або зі значенням, більшим за -тривалість вашого найдовшого завдання workflow. Тримайте -`workflows.v2.workflow_task_lease_seconds` вищим за це значення. У Horizon -параметр `timeout` супервізора є тим самим налаштуванням. +У Horizon параметр `timeout` кожного супервізора є тайм-аутом worker. Новіші +випуски Workflow задають цей тайм-аут кожному job завдання workflow (оренда +мінус 30 секунд, і щонайменше на 10 секунд менше за `retry_after`), тож короткий +тайм-аут worker більше не завершує завдання workflow. Worker у черзі workflow +під час запуску записує в журнал попередження, коли `retry_after` обмежує +завдання workflow. diff --git a/i18n/uk/source-hashes.json b/i18n/uk/source-hashes.json index 03fa661e095..61308987006 100644 --- a/i18n/uk/source-hashes.json +++ b/i18n/uk/source-hashes.json @@ -60,7 +60,7 @@ "features/webhooks.md": "edcdfc05ccb0d34a77c51594f85bc3cab343e787f8e0e08d2cd4ddebd048e8c8", "features/worker-sessions.md": "5065368fb5b93599dbd08d97cb9ac312576eb42fee14f081db663aa9f78fb68c", "how-it-works.md": "90454c37f4244297d5c11bcc59549859acf59f88d15ecd26f0a6951c115f86eb", - "installation.md": "1384821f2c5069cfa2b6f51445aba7fc10c021ea3215e32c47afbfb207180416", + "installation.md": "117ba373ee55eda1ddd3c160985d686ca6b18e242228e3b63ca54869ec3705f9", "introduction.md": "06bf96d164d402d4e376c6308b20f96d324110b2e0cf96c2a1a67b39906072e3", "laravel-adoption.md": "55a4df64436667b9477c9a39dd69ddde9f4c30739ba3dfd2ff316b553a55ba4f", "mcp-workflows.md": "1c0b5bb7f2e5c7ca835dfdfa57bbe8f6624172c855f4e225057ac2377abf360e", diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/installation.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/installation.md index 79deb6728f1..3bba2830bb1 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/installation.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/installation.md @@ -55,10 +55,30 @@ Durable Workflow 使用队列在后台执行工作流和活动。运行 [`queue: ### Worker 超时 {#worker-timeout} -```bash -php artisan queue:work --timeout=0 +当 PHP 启用了 `pcntl` 扩展时,队列 Worker 会终止运行时间超过其超时的任何作业。这个超时就是 Worker 的 `--timeout`,默认 60 秒,除非作业设置了自己的超时。被终止的工作流任务会失去租约并被回滚。只有在租约到期(`workflows.v2.workflow_task_lease_seconds`,默认 300 秒)后才会重试,而重试会重复同样的工作。始终需要比超时更长时间的工作流任务(例如调度或完成一个大规模 `all()` 的任务)永远无法完成。 + +以下三项设置必须相互匹配: + +- **工作流任务超时**必须小于**工作流任务租约**。运行超过租约的工作无法完成。 +- 队列连接的 **`retry_after`** 必须大于该连接上每个作业的超时,这是 Laravel 的要求。否则,队列会把仍在运行的作业交给第二个 Worker。 +- **活动**应保留有上限的超时,以免挂起的活动永远占用 Worker。不要使用 `--timeout=0`。 + +在专用的队列连接上运行工作流任务,该连接的 `retry_after` 要大于租约,Worker 的 `--timeout` 要小于租约。在另一个队列上运行活动,并使用适合它们的超时。除非活动类设置了自己的 `$connection` 或 `$queue`,活动会使用其工作流的队列。 + +```php +// config/queue.php: a connection for workflow tasks +'workflows' => [ + 'driver' => 'redis', + 'connection' => 'default', + 'queue' => 'workflows', + 'retry_after' => 330, // above the 300-second workflow task lease +], ``` -当 PHP 启用了 `pcntl` 扩展时,`queue:work` 会终止运行时间超过 `--timeout` 秒的任何作业,默认值为 60。以这种方式被终止的工作流任务会被回滚。它会在工作流任务租约到期(默认 300 秒)后重试,而重试会重复同样的工作。始终需要比超时更长时间的工作流任务(例如调度或完成一个大规模 `all()` 的任务)永远无法完成。 +```bash +# DW_V2_CONNECTION=workflows DW_V2_QUEUE=workflows +php artisan queue:work workflows --queue=workflows --timeout=270 +php artisan queue:work --queue=default --timeout=60 +``` -运行工作流 Worker 时请使用 `--timeout=0`,或使用大于最长工作流任务耗时的值。让 `workflows.v2.workflow_task_lease_seconds` 保持大于该值。在 Horizon 中,supervisor 的 `timeout` 选项就是同一个设置。 +在 Horizon 中,每个 supervisor 的 `timeout` 选项就是 Worker 超时。较新的 Workflow 版本会为每个工作流任务作业设置这一超时(租约减去 30 秒,并保持比 `retry_after` 至少小 10 秒),因此较短的 Worker 超时不再会终止工作流任务。当 `retry_after` 限制了工作流任务时,工作流队列上的 Worker 会在启动时记录一条警告。 diff --git a/i18n/zh-Hans/source-hashes.json b/i18n/zh-Hans/source-hashes.json index 03fa661e095..61308987006 100644 --- a/i18n/zh-Hans/source-hashes.json +++ b/i18n/zh-Hans/source-hashes.json @@ -60,7 +60,7 @@ "features/webhooks.md": "edcdfc05ccb0d34a77c51594f85bc3cab343e787f8e0e08d2cd4ddebd048e8c8", "features/worker-sessions.md": "5065368fb5b93599dbd08d97cb9ac312576eb42fee14f081db663aa9f78fb68c", "how-it-works.md": "90454c37f4244297d5c11bcc59549859acf59f88d15ecd26f0a6951c115f86eb", - "installation.md": "1384821f2c5069cfa2b6f51445aba7fc10c021ea3215e32c47afbfb207180416", + "installation.md": "117ba373ee55eda1ddd3c160985d686ca6b18e242228e3b63ca54869ec3705f9", "introduction.md": "06bf96d164d402d4e376c6308b20f96d324110b2e0cf96c2a1a67b39906072e3", "laravel-adoption.md": "55a4df64436667b9477c9a39dd69ddde9f4c30739ba3dfd2ff316b553a55ba4f", "mcp-workflows.md": "1c0b5bb7f2e5c7ca835dfdfa57bbe8f6624172c855f4e225057ac2377abf360e", From ae5c1ac99ca93a73b710f53dab115203d1411a9d Mon Sep 17 00:00:00 2001 From: Richard McDaniel <1130888+rmcdaniel@users.noreply.github.com> Date: Thu, 19 Nov 2026 19:16:58 +0000 Subject: [PATCH 5/5] Correct the worker timeout guide for the opt-in job timeout The workflow task job timeout is opt-in from Workflow 2.34.0; by default the worker's --timeout applies. Drop the claim that work past the lease cannot complete, say that killed tasks are counted as lost leases, and route activities to the bounded worker through the activity's $queue. Co-Authored-By: Claude Opus 5.5 --- docs/installation.md | 32 +++++---- .../current/installation.md | 32 +++++---- i18n/de/source-hashes.json | 2 +- .../current/installation.md | 64 ++++++++++-------- i18n/es/source-hashes.json | 2 +- .../current/installation.md | 32 +++++---- i18n/fr/source-hashes.json | 2 +- .../current/installation.md | 32 +++++---- i18n/ja/source-hashes.json | 2 +- .../current/installation.md | 63 ++++++++++-------- i18n/pt-BR/source-hashes.json | 2 +- .../current/installation.md | 66 +++++++++++-------- i18n/uk/source-hashes.json | 2 +- .../current/installation.md | 32 +++++---- i18n/zh-Hans/source-hashes.json | 2 +- 15 files changed, 226 insertions(+), 141 deletions(-) diff --git a/docs/installation.md b/docs/installation.md index 41ea8fb1933..c27cd770f8a 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -65,30 +65,40 @@ Durable Workflow uses queues to run workflows and activities in the background. ### Worker timeout {#worker-timeout} -When PHP has the `pcntl` extension, a queue worker kills any job that runs longer than its timeout: the worker's `--timeout`, 60 seconds by default, unless the job sets its own. A workflow task that is killed loses its lease and is rolled back. It is retried only after the lease expires (`workflows.v2.workflow_task_lease_seconds`, 300 seconds by default), and the retry repeats the same work. A workflow task that always needs longer than the timeout, such as one that schedules or finishes a wide `all()`, never completes. +When PHP has the `pcntl` extension, a queue worker kills any job that runs longer than its timeout: the worker's `--timeout`, 60 seconds by default, unless the job sets its own. A workflow task that is killed is rolled back. It is retried only after its lease expires (`workflows.v2.workflow_task_lease_seconds`, 300 seconds by default) and is counted as a lost lease, and the retry repeats the same work. A workflow task that always needs longer than the timeout, such as one that schedules or finishes a wide `all()`, never completes. Three settings must line up: -- The **workflow task timeout** must be below the **workflow task lease**. Work that runs past the lease cannot complete. +- The **timeout of the workers that run workflow tasks** must cover your longest workflow task. A killed workflow task waits out the rest of its lease before it is retried. - The queue connection's **`retry_after`** must exceed the timeout of every job on it, as Laravel requires. Otherwise the queue hands a job that is still running to a second worker. - **Activities** should keep a bounded timeout, so that a hung activity cannot hold a worker forever. Do not use `--timeout=0`. -Run workflow tasks on their own queue connection whose `retry_after` exceeds the lease, with workers whose `--timeout` is below the lease. Run activities on another queue with a timeout that suits them. Activities use their workflow's queue unless the activity class sets its own `$connection` or `$queue`. +To give activities a shorter timeout than workflow tasks, run them on their own queue with their own workers. Activities run on their workflow's connection and queue unless the activity class sets `$connection` or `$queue`, or the workflow passes `ActivityOptions`. ```php -// config/queue.php: a connection for workflow tasks -'workflows' => [ +// config/queue.php +'redis' => [ 'driver' => 'redis', 'connection' => 'default', - 'queue' => 'workflows', - 'retry_after' => 330, // above the 300-second workflow task lease + 'queue' => 'default', + 'retry_after' => 330, // above the workflow task workers' timeout ], ``` +```php +use Workflow\V2\Activity; + +final class ChargeCardActivity extends Activity +{ + public ?string $queue = 'activities'; +} +``` + ```bash -# DW_V2_CONNECTION=workflows DW_V2_QUEUE=workflows -php artisan queue:work workflows --queue=workflows --timeout=270 -php artisan queue:work --queue=default --timeout=60 +php artisan queue:work redis --queue=default --timeout=300 # workflow tasks +php artisan queue:work redis --queue=activities --timeout=60 # activities ``` -In Horizon, each supervisor's `timeout` option is the worker timeout. Newer Workflow releases give every workflow task job this timeout (the lease less 30 seconds, kept 10 seconds below `retry_after`), so a short worker timeout no longer kills workflow tasks. A worker on the workflow queue logs a warning at start when `retry_after` limits workflow tasks. +In Horizon, each supervisor's `timeout` option is the worker timeout. + +Workflow 2.34.0 adds `DW_V2_WORKFLOW_TASK_JOB_TIMEOUT_SECONDS`, unset by default. When it is set, every workflow task job carries that timeout, kept 10 seconds below its connection's `retry_after`, and workers use it in place of their own timeout for those jobs, so workflow tasks and activities can share workers. From that release, a worker that serves the workflow queue logs a warning at start when the timeout its workflow tasks run under is below the workflow task lease. diff --git a/i18n/de/docusaurus-plugin-content-docs/current/installation.md b/i18n/de/docusaurus-plugin-content-docs/current/installation.md index 7440ddf26f9..50e7074b18f 100644 --- a/i18n/de/docusaurus-plugin-content-docs/current/installation.md +++ b/i18n/de/docusaurus-plugin-content-docs/current/installation.md @@ -57,30 +57,40 @@ Durable Workflow führt Workflows und Aktivitäten im Hintergrund über Wartesch ### Worker-Timeout {#worker-timeout} -Wenn PHP die Erweiterung `pcntl` hat, beendet ein Queue-Worker jeden Job, der länger als sein Timeout läuft: das `--timeout` des Workers, standardmäßig 60 Sekunden, sofern der Job kein eigenes festlegt. Eine so beendete Workflow-Aufgabe verliert ihre Lease und wird zurückgerollt. Sie wird erst nach Ablauf der Lease erneut versucht (`workflows.v2.workflow_task_lease_seconds`, standardmäßig 300 Sekunden), und der neue Versuch wiederholt dieselbe Arbeit. Eine Workflow-Aufgabe, die immer länger als das Timeout braucht, etwa eine, die ein breites `all()` plant oder abschließt, wird nie abgeschlossen. +Wenn PHP die Erweiterung `pcntl` hat, beendet ein Queue-Worker jeden Job, der länger als sein Timeout läuft: das `--timeout` des Workers, standardmäßig 60 Sekunden, sofern der Job kein eigenes festlegt. Eine so beendete Workflow-Aufgabe wird zurückgerollt. Sie wird erst nach Ablauf ihrer Lease erneut versucht (`workflows.v2.workflow_task_lease_seconds`, standardmäßig 300 Sekunden) und als verlorene Lease gezählt, und der neue Versuch wiederholt dieselbe Arbeit. Eine Workflow-Aufgabe, die immer länger als das Timeout braucht, etwa eine, die ein breites `all()` plant oder abschließt, wird nie abgeschlossen. Drei Einstellungen müssen zusammenpassen: -- Das **Timeout der Workflow-Aufgabe** muss unter der **Lease der Workflow-Aufgabe** liegen. Arbeit, die über die Lease hinaus läuft, kann nicht abgeschlossen werden. +- Das **Timeout der Worker, die Workflow-Aufgaben ausführen**, muss Ihre längste Workflow-Aufgabe abdecken. Eine beendete Workflow-Aufgabe wartet den Rest ihrer Lease ab, bevor sie erneut versucht wird. - **`retry_after`** der Queue-Verbindung muss das Timeout jedes Jobs auf dieser Verbindung übersteigen, wie Laravel es verlangt. Andernfalls übergibt die Queue einen noch laufenden Job an einen zweiten Worker. - **Aktivitäten** sollten ein begrenztes Timeout behalten, damit eine hängende Aktivität einen Worker nicht für immer blockieren kann. Verwenden Sie nicht `--timeout=0`. -Führen Sie Workflow-Aufgaben auf einer eigenen Queue-Verbindung aus, deren `retry_after` die Lease übersteigt, mit Workern, deren `--timeout` unter der Lease liegt. Führen Sie Aktivitäten auf einer anderen Queue mit einem für sie passenden Timeout aus. Aktivitäten verwenden die Queue ihres Workflows, sofern die Aktivitätsklasse nicht eigene `$connection`- oder `$queue`-Werte festlegt. +Damit Aktivitäten ein kürzeres Timeout als Workflow-Aufgaben erhalten, führen Sie sie auf einer eigenen Queue mit eigenen Workern aus. Aktivitäten laufen auf der Verbindung und Queue ihres Workflows, es sei denn, die Aktivitätsklasse legt `$connection` oder `$queue` fest oder der Workflow übergibt `ActivityOptions`. ```php -// config/queue.php: a connection for workflow tasks -'workflows' => [ +// config/queue.php +'redis' => [ 'driver' => 'redis', 'connection' => 'default', - 'queue' => 'workflows', - 'retry_after' => 330, // above the 300-second workflow task lease + 'queue' => 'default', + 'retry_after' => 330, // above the workflow task workers' timeout ], ``` +```php +use Workflow\V2\Activity; + +final class ChargeCardActivity extends Activity +{ + public ?string $queue = 'activities'; +} +``` + ```bash -# DW_V2_CONNECTION=workflows DW_V2_QUEUE=workflows -php artisan queue:work workflows --queue=workflows --timeout=270 -php artisan queue:work --queue=default --timeout=60 +php artisan queue:work redis --queue=default --timeout=300 # workflow tasks +php artisan queue:work redis --queue=activities --timeout=60 # activities ``` -In Horizon ist die Option `timeout` jedes Supervisors das Worker-Timeout. Neuere Workflow-Releases geben jedem Job einer Workflow-Aufgabe dieses Timeout (die Lease abzüglich 30 Sekunden, mindestens 10 Sekunden unter `retry_after` gehalten), sodass ein kurzes Worker-Timeout Workflow-Aufgaben nicht mehr beendet. Ein Worker auf der Workflow-Queue protokolliert beim Start eine Warnung, wenn `retry_after` Workflow-Aufgaben begrenzt. +In Horizon ist die Option `timeout` jedes Supervisors das Worker-Timeout. + +Workflow 2.34.0 fügt `DW_V2_WORKFLOW_TASK_JOB_TIMEOUT_SECONDS` hinzu, das standardmäßig nicht gesetzt ist. Ist es gesetzt, trägt jeder Job einer Workflow-Aufgabe dieses Timeout, mindestens 10 Sekunden unter dem `retry_after` seiner Verbindung gehalten, und Worker verwenden es für diese Jobs anstelle ihres eigenen Timeouts, sodass sich Workflow-Aufgaben und Aktivitäten Worker teilen können. Ab diesem Release protokolliert ein Worker, der die Workflow-Queue bedient, beim Start eine Warnung, wenn das Timeout, unter dem seine Workflow-Aufgaben laufen, unter der Lease der Workflow-Aufgabe liegt. diff --git a/i18n/de/source-hashes.json b/i18n/de/source-hashes.json index 2026abbde4c..db9945da106 100644 --- a/i18n/de/source-hashes.json +++ b/i18n/de/source-hashes.json @@ -60,7 +60,7 @@ "features/webhooks.md": "edcdfc05ccb0d34a77c51594f85bc3cab343e787f8e0e08d2cd4ddebd048e8c8", "features/worker-sessions.md": "5065368fb5b93599dbd08d97cb9ac312576eb42fee14f081db663aa9f78fb68c", "how-it-works.md": "90454c37f4244297d5c11bcc59549859acf59f88d15ecd26f0a6951c115f86eb", - "installation.md": "117ba373ee55eda1ddd3c160985d686ca6b18e242228e3b63ca54869ec3705f9", + "installation.md": "8b2599dd58cda5a455c7df1ef4897521f9ec4ca823282f7446828024bce08117", "introduction.md": "06bf96d164d402d4e376c6308b20f96d324110b2e0cf96c2a1a67b39906072e3", "laravel-adoption.md": "55a4df64436667b9477c9a39dd69ddde9f4c30739ba3dfd2ff316b553a55ba4f", "mcp-workflows.md": "1c0b5bb7f2e5c7ca835dfdfa57bbe8f6624172c855f4e225057ac2377abf360e", diff --git a/i18n/es/docusaurus-plugin-content-docs/current/installation.md b/i18n/es/docusaurus-plugin-content-docs/current/installation.md index 99c0d946380..5ed5020a865 100644 --- a/i18n/es/docusaurus-plugin-content-docs/current/installation.md +++ b/i18n/es/docusaurus-plugin-content-docs/current/installation.md @@ -74,17 +74,17 @@ procesan. Para ejecutarlos en paralelo, necesitas más de un worker. Cuando PHP tiene la extensión `pcntl`, un worker de colas termina cualquier job que se ejecute más allá de su tiempo límite: el `--timeout` del worker, 60 segundos por defecto, salvo que el job defina el suyo. Una tarea de workflow -terminada así pierde su lease y se revierte. Solo se reintenta cuando vence el -lease (`workflows.v2.workflow_task_lease_seconds`, 300 segundos por defecto), y -el reintento repite el mismo trabajo. Una tarea de workflow que siempre necesita -más tiempo que el límite, como una que programa o termina un `all()` amplio, -nunca se completa. +terminada así se revierte. Solo se reintenta cuando vence su lease +(`workflows.v2.workflow_task_lease_seconds`, 300 segundos por defecto) y se +cuenta como un lease perdido, y el reintento repite el mismo trabajo. Una tarea +de workflow que siempre necesita más tiempo que el límite, como una que programa +o termina un `all()` amplio, nunca se completa. Tres ajustes deben encajar: -- El **tiempo límite de la tarea de workflow** debe ser inferior al - **lease de la tarea de workflow**. El trabajo que se prolonga más allá del - lease no puede completarse. +- El **tiempo límite de los workers que ejecutan tareas de workflow** debe + cubrir tu tarea de workflow más larga. Una tarea de workflow terminada espera + el resto de su lease antes de reintentarse. - El **`retry_after`** de la conexión de cola debe superar el tiempo límite de cada job que pase por ella, como exige Laravel. De lo contrario, la cola entrega un job que sigue en ejecución a un segundo worker. @@ -92,32 +92,44 @@ Tres ajustes deben encajar: actividad bloqueada no pueda retener un worker para siempre. No uses `--timeout=0`. -Ejecuta las tareas de workflow en su propia conexión de cola, con un -`retry_after` superior al lease y con workers cuyo `--timeout` sea inferior al -lease. Ejecuta las actividades en otra cola con un tiempo límite adecuado para -ellas. Las actividades usan la cola de su workflow, salvo que la clase de la -actividad defina su propio `$connection` o `$queue`. +Para dar a las actividades un tiempo límite más corto que a las tareas de +workflow, ejecútalas en su propia cola con sus propios workers. Las actividades +se ejecutan en la conexión y la cola de su workflow, salvo que la clase de la +actividad defina `$connection` o `$queue`, o que el workflow pase +`ActivityOptions`. ```php -// config/queue.php: a connection for workflow tasks -'workflows' => [ +// config/queue.php +'redis' => [ 'driver' => 'redis', 'connection' => 'default', - 'queue' => 'workflows', - 'retry_after' => 330, // above the 300-second workflow task lease + 'queue' => 'default', + 'retry_after' => 330, // above the workflow task workers' timeout ], ``` +```php +use Workflow\V2\Activity; + +final class ChargeCardActivity extends Activity +{ + public ?string $queue = 'activities'; +} +``` + ```bash -# DW_V2_CONNECTION=workflows DW_V2_QUEUE=workflows -php artisan queue:work workflows --queue=workflows --timeout=270 -php artisan queue:work --queue=default --timeout=60 +php artisan queue:work redis --queue=default --timeout=300 # workflow tasks +php artisan queue:work redis --queue=activities --timeout=60 # activities ``` En Horizon, la opción `timeout` de cada supervisor es el tiempo límite del -worker. Las versiones más recientes de Workflow asignan este tiempo límite a -cada job de tarea de workflow (el lease menos 30 segundos, mantenido al menos 10 -segundos por debajo de `retry_after`), de modo que un tiempo límite corto del -worker ya no termina las tareas de workflow. Un worker de la cola de workflows -registra una advertencia al iniciarse cuando `retry_after` limita las tareas de -workflow. +worker. + +Workflow 2.34.0 añade `DW_V2_WORKFLOW_TASK_JOB_TIMEOUT_SECONDS`, sin definir por +defecto. Cuando se define, cada job de tarea de workflow lleva ese tiempo +límite, mantenido al menos 10 segundos por debajo del `retry_after` de su +conexión, y los workers lo usan en lugar de su propio tiempo límite para esos +jobs, de modo que las tareas de workflow y las actividades pueden compartir +workers. A partir de esa versión, un worker que atiende la cola de workflows +registra una advertencia al iniciarse cuando el tiempo límite con el que se +ejecutan sus tareas de workflow es inferior al lease de la tarea de workflow. diff --git a/i18n/es/source-hashes.json b/i18n/es/source-hashes.json index 2026abbde4c..db9945da106 100644 --- a/i18n/es/source-hashes.json +++ b/i18n/es/source-hashes.json @@ -60,7 +60,7 @@ "features/webhooks.md": "edcdfc05ccb0d34a77c51594f85bc3cab343e787f8e0e08d2cd4ddebd048e8c8", "features/worker-sessions.md": "5065368fb5b93599dbd08d97cb9ac312576eb42fee14f081db663aa9f78fb68c", "how-it-works.md": "90454c37f4244297d5c11bcc59549859acf59f88d15ecd26f0a6951c115f86eb", - "installation.md": "117ba373ee55eda1ddd3c160985d686ca6b18e242228e3b63ca54869ec3705f9", + "installation.md": "8b2599dd58cda5a455c7df1ef4897521f9ec4ca823282f7446828024bce08117", "introduction.md": "06bf96d164d402d4e376c6308b20f96d324110b2e0cf96c2a1a67b39906072e3", "laravel-adoption.md": "55a4df64436667b9477c9a39dd69ddde9f4c30739ba3dfd2ff316b553a55ba4f", "mcp-workflows.md": "1c0b5bb7f2e5c7ca835dfdfa57bbe8f6624172c855f4e225057ac2377abf360e", diff --git a/i18n/fr/docusaurus-plugin-content-docs/current/installation.md b/i18n/fr/docusaurus-plugin-content-docs/current/installation.md index f74b1ff4004..dbe64dcf38a 100644 --- a/i18n/fr/docusaurus-plugin-content-docs/current/installation.md +++ b/i18n/fr/docusaurus-plugin-content-docs/current/installation.md @@ -57,30 +57,40 @@ Durable Workflow utilise des files pour exécuter les workflows et les activité ### Délai d’expiration du worker {#worker-timeout} -Lorsque PHP dispose de l’extension `pcntl`, un worker de file tue tout job qui s’exécute au-delà de son délai d’expiration : le `--timeout` du worker, 60 secondes par défaut, sauf si le job définit le sien. Une tâche de workflow tuée perd son bail et ses changements sont annulés. Elle n’est relancée qu’après l’expiration du bail (`workflows.v2.workflow_task_lease_seconds`, 300 secondes par défaut), et la nouvelle tentative refait le même travail. Une tâche de workflow qui a toujours besoin de plus de temps que ce délai, par exemple une tâche qui planifie ou termine un large `all()`, ne se termine jamais. +Lorsque PHP dispose de l’extension `pcntl`, un worker de file tue tout job qui s’exécute au-delà de son délai d’expiration : le `--timeout` du worker, 60 secondes par défaut, sauf si le job définit le sien. Les changements d’une tâche de workflow tuée sont annulés. Elle n’est relancée qu’après l’expiration de son bail (`workflows.v2.workflow_task_lease_seconds`, 300 secondes par défaut) et est comptée comme un bail perdu, et la nouvelle tentative refait le même travail. Une tâche de workflow qui a toujours besoin de plus de temps que ce délai, par exemple une tâche qui planifie ou termine un large `all()`, ne se termine jamais. Trois réglages doivent être cohérents : -- Le **délai d’expiration de la tâche de workflow** doit être inférieur au **bail de la tâche de workflow**. Un travail qui dépasse le bail ne peut pas se terminer. +- Le **délai d’expiration des workers qui exécutent les tâches de workflow** doit couvrir votre plus longue tâche de workflow. Une tâche de workflow tuée attend la fin de son bail avant d’être relancée. - Le **`retry_after`** de la connexion de file doit dépasser le délai d’expiration de chaque job qu’elle transporte, comme l’exige Laravel. Sinon, la file confie un job encore en cours à un second worker. - Les **activités** doivent garder un délai d’expiration borné, afin qu’une activité bloquée ne puisse pas occuper un worker indéfiniment. N’utilisez pas `--timeout=0`. -Exécutez les tâches de workflow sur leur propre connexion de file, dont le `retry_after` dépasse le bail, avec des workers dont le `--timeout` est inférieur au bail. Exécutez les activités sur une autre file avec un délai d’expiration qui leur convient. Les activités utilisent la file de leur workflow, sauf si la classe d’activité définit ses propres `$connection` ou `$queue`. +Pour donner aux activités un délai d’expiration plus court qu’aux tâches de workflow, exécutez-les sur leur propre file avec leurs propres workers. Les activités s’exécutent sur la connexion et la file de leur workflow, sauf si la classe d’activité définit `$connection` ou `$queue`, ou si le workflow transmet des `ActivityOptions`. ```php -// config/queue.php: a connection for workflow tasks -'workflows' => [ +// config/queue.php +'redis' => [ 'driver' => 'redis', 'connection' => 'default', - 'queue' => 'workflows', - 'retry_after' => 330, // above the 300-second workflow task lease + 'queue' => 'default', + 'retry_after' => 330, // above the workflow task workers' timeout ], ``` +```php +use Workflow\V2\Activity; + +final class ChargeCardActivity extends Activity +{ + public ?string $queue = 'activities'; +} +``` + ```bash -# DW_V2_CONNECTION=workflows DW_V2_QUEUE=workflows -php artisan queue:work workflows --queue=workflows --timeout=270 -php artisan queue:work --queue=default --timeout=60 +php artisan queue:work redis --queue=default --timeout=300 # workflow tasks +php artisan queue:work redis --queue=activities --timeout=60 # activities ``` -Dans Horizon, l’option `timeout` de chaque superviseur est le délai d’expiration du worker. Les versions plus récentes de Workflow attribuent ce délai à chaque job de tâche de workflow (le bail moins 30 secondes, maintenu au moins 10 secondes sous `retry_after`), si bien qu’un délai court du worker ne tue plus les tâches de workflow. Un worker de la file des workflows journalise un avertissement au démarrage lorsque `retry_after` limite les tâches de workflow. +Dans Horizon, l’option `timeout` de chaque superviseur est le délai d’expiration du worker. + +Workflow 2.34.0 ajoute `DW_V2_WORKFLOW_TASK_JOB_TIMEOUT_SECONDS`, non défini par défaut. Lorsqu’il est défini, chaque job de tâche de workflow porte ce délai, maintenu au moins 10 secondes sous le `retry_after` de sa connexion, et les workers l’utilisent à la place de leur propre délai pour ces jobs, si bien que tâches de workflow et activités peuvent partager les mêmes workers. À partir de cette version, un worker qui sert la file des workflows journalise un avertissement au démarrage lorsque le délai sous lequel s’exécutent ses tâches de workflow est inférieur au bail de tâche de workflow. diff --git a/i18n/fr/source-hashes.json b/i18n/fr/source-hashes.json index 2026abbde4c..db9945da106 100644 --- a/i18n/fr/source-hashes.json +++ b/i18n/fr/source-hashes.json @@ -60,7 +60,7 @@ "features/webhooks.md": "edcdfc05ccb0d34a77c51594f85bc3cab343e787f8e0e08d2cd4ddebd048e8c8", "features/worker-sessions.md": "5065368fb5b93599dbd08d97cb9ac312576eb42fee14f081db663aa9f78fb68c", "how-it-works.md": "90454c37f4244297d5c11bcc59549859acf59f88d15ecd26f0a6951c115f86eb", - "installation.md": "117ba373ee55eda1ddd3c160985d686ca6b18e242228e3b63ca54869ec3705f9", + "installation.md": "8b2599dd58cda5a455c7df1ef4897521f9ec4ca823282f7446828024bce08117", "introduction.md": "06bf96d164d402d4e376c6308b20f96d324110b2e0cf96c2a1a67b39906072e3", "laravel-adoption.md": "55a4df64436667b9477c9a39dd69ddde9f4c30739ba3dfd2ff316b553a55ba4f", "mcp-workflows.md": "1c0b5bb7f2e5c7ca835dfdfa57bbe8f6624172c855f4e225057ac2377abf360e", diff --git a/i18n/ja/docusaurus-plugin-content-docs/current/installation.md b/i18n/ja/docusaurus-plugin-content-docs/current/installation.md index d7ff5313712..cd066cf10c8 100644 --- a/i18n/ja/docusaurus-plugin-content-docs/current/installation.md +++ b/i18n/ja/docusaurus-plugin-content-docs/current/installation.md @@ -56,30 +56,40 @@ Durable Workflow はキューを使って、ワークフローとアクティビ ### Worker のタイムアウト {#worker-timeout} -PHP に `pcntl` 拡張がある場合、キュー Worker はタイムアウトを超えて実行されたジョブを強制終了します。タイムアウトは Worker の `--timeout`(デフォルトは 60 秒)で、ジョブが独自に設定している場合はその値です。強制終了されたワークフロータスクはリースを失い、ロールバックされます。再試行はリースの期限(`workflows.v2.workflow_task_lease_seconds`、デフォルトは 300 秒)が切れた後にしか行われず、再試行では同じ作業が繰り返されます。幅の広い `all()` をスケジュールまたは完了するタスクのように、常にタイムアウトより長い時間を必要とするワークフロータスクは、いつまでも完了しません。 +PHP に `pcntl` 拡張がある場合、キュー Worker はタイムアウトを超えて実行されたジョブを強制終了します。タイムアウトは Worker の `--timeout`(デフォルトは 60 秒)で、ジョブが独自に設定している場合はその値です。強制終了されたワークフロータスクはロールバックされます。再試行はリースの期限(`workflows.v2.workflow_task_lease_seconds`、デフォルトは 300 秒)が切れた後にしか行われず、リースの喪失として数えられます。再試行では同じ作業が繰り返されます。幅の広い `all()` をスケジュールまたは完了するタスクのように、常にタイムアウトより長い時間を必要とするワークフロータスクは、いつまでも完了しません。 次の三つの設定を揃える必要があります。 -- **ワークフロータスクのタイムアウト**は**ワークフロータスクのリース**より短くしなければなりません。リースを超えて実行される作業は完了できません。 +- **ワークフロータスクを実行する Worker のタイムアウト**は、最も長いワークフロータスクをカバーできなければなりません。強制終了されたワークフロータスクは、リースの残り時間が過ぎるのを待ってから再試行されます。 - キュー接続の **`retry_after`** は、Laravel が求めるとおり、その接続上のすべてのジョブのタイムアウトより長くしなければなりません。そうでないと、キューはまだ実行中のジョブを別の Worker に渡してしまいます。 - **アクティビティ**には上限のあるタイムアウトを残し、ハングしたアクティビティが Worker を永久に占有できないようにしてください。`--timeout=0` は使わないでください。 -ワークフロータスクは専用のキュー接続で実行し、その接続の `retry_after` をリースより長く、Worker の `--timeout` をリースより短くしてください。アクティビティは、それに合ったタイムアウトを設定した別のキューで実行してください。アクティビティクラスが独自の `$connection` または `$queue` を設定していない限り、アクティビティはワークフローのキューを使います。 +アクティビティにワークフロータスクより短いタイムアウトを設定するには、アクティビティを専用のキューと専用の Worker で実行してください。アクティビティクラスが `$connection` または `$queue` を設定している場合や、ワークフローが `ActivityOptions` を渡す場合を除き、アクティビティはワークフローの接続とキューで実行されます。 ```php -// config/queue.php: a connection for workflow tasks -'workflows' => [ +// config/queue.php +'redis' => [ 'driver' => 'redis', 'connection' => 'default', - 'queue' => 'workflows', - 'retry_after' => 330, // above the 300-second workflow task lease + 'queue' => 'default', + 'retry_after' => 330, // above the workflow task workers' timeout ], ``` +```php +use Workflow\V2\Activity; + +final class ChargeCardActivity extends Activity +{ + public ?string $queue = 'activities'; +} +``` + ```bash -# DW_V2_CONNECTION=workflows DW_V2_QUEUE=workflows -php artisan queue:work workflows --queue=workflows --timeout=270 -php artisan queue:work --queue=default --timeout=60 +php artisan queue:work redis --queue=default --timeout=300 # workflow tasks +php artisan queue:work redis --queue=activities --timeout=60 # activities ``` -Horizon では、各 supervisor の `timeout` オプションが Worker のタイムアウトです。新しい Workflow リリースでは、すべてのワークフロータスクのジョブにこのタイムアウト(リースから 30 秒を引いた値で、`retry_after` より少なくとも 10 秒短く保たれます)が設定されるため、短い Worker タイムアウトでワークフロータスクが強制終了されることはなくなります。ワークフローキューの Worker は、`retry_after` がワークフロータスクを制限している場合、起動時に警告をログに出力します。 +Horizon では、各 supervisor の `timeout` オプションが Worker のタイムアウトです。 + +Workflow 2.34.0 では `DW_V2_WORKFLOW_TASK_JOB_TIMEOUT_SECONDS` が追加されました(デフォルトでは未設定)。設定すると、すべてのワークフロータスクのジョブがそのタイムアウトを持ち(接続の `retry_after` より少なくとも 10 秒短く保たれます)、Worker はそれらのジョブに自身のタイムアウトの代わりにその値を使うため、ワークフロータスクとアクティビティで Worker を共有できます。このリリース以降、ワークフローキューを処理する Worker は、ワークフロータスクの実行時に適用されるタイムアウトがワークフロータスクのリースより短い場合、起動時に警告をログに出力します。 diff --git a/i18n/ja/source-hashes.json b/i18n/ja/source-hashes.json index 2026abbde4c..db9945da106 100644 --- a/i18n/ja/source-hashes.json +++ b/i18n/ja/source-hashes.json @@ -60,7 +60,7 @@ "features/webhooks.md": "edcdfc05ccb0d34a77c51594f85bc3cab343e787f8e0e08d2cd4ddebd048e8c8", "features/worker-sessions.md": "5065368fb5b93599dbd08d97cb9ac312576eb42fee14f081db663aa9f78fb68c", "how-it-works.md": "90454c37f4244297d5c11bcc59549859acf59f88d15ecd26f0a6951c115f86eb", - "installation.md": "117ba373ee55eda1ddd3c160985d686ca6b18e242228e3b63ca54869ec3705f9", + "installation.md": "8b2599dd58cda5a455c7df1ef4897521f9ec4ca823282f7446828024bce08117", "introduction.md": "06bf96d164d402d4e376c6308b20f96d324110b2e0cf96c2a1a67b39906072e3", "laravel-adoption.md": "55a4df64436667b9477c9a39dd69ddde9f4c30739ba3dfd2ff316b553a55ba4f", "mcp-workflows.md": "1c0b5bb7f2e5c7ca835dfdfa57bbe8f6624172c855f4e225057ac2377abf360e", diff --git a/i18n/pt-BR/docusaurus-plugin-content-docs/current/installation.md b/i18n/pt-BR/docusaurus-plugin-content-docs/current/installation.md index cb660465afc..bdf69711c0d 100644 --- a/i18n/pt-BR/docusaurus-plugin-content-docs/current/installation.md +++ b/i18n/pt-BR/docusaurus-plugin-content-docs/current/installation.md @@ -76,48 +76,59 @@ executá-los em paralelo, você precisa de mais de um worker de fila. Quando o PHP tem a extensão `pcntl`, um worker de fila encerra qualquer job que rode além do seu timeout: o `--timeout` do worker, 60 segundos por padrão, a menos que o job defina o próprio. Uma tarefa de workflow encerrada dessa forma -perde o lease e sofre rollback. Ela só é tentada novamente depois que o lease -expira (`workflows.v2.workflow_task_lease_seconds`, 300 segundos por padrão), e -a nova tentativa repete o mesmo trabalho. Uma tarefa de workflow que sempre -precisa de mais tempo que o timeout, como uma que agenda ou conclui um `all()` -amplo, nunca é concluída. +sofre rollback. Ela só é tentada novamente depois que o seu lease expira +(`workflows.v2.workflow_task_lease_seconds`, 300 segundos por padrão) e é +contada como um lease perdido, e a nova tentativa repete o mesmo trabalho. Uma +tarefa de workflow que sempre precisa de mais tempo que o timeout, como uma que +agenda ou conclui um `all()` amplo, nunca é concluída. Três configurações precisam estar alinhadas: -- O **timeout da tarefa de workflow** precisa ficar abaixo do - **lease da tarefa de workflow**. Trabalho que ultrapassa o lease não consegue - ser concluído. +- O **timeout dos workers que executam tarefas de workflow** precisa cobrir sua + tarefa de workflow mais longa. Uma tarefa de workflow encerrada espera o + restante do seu lease antes de ser tentada novamente. - O **`retry_after`** da conexão de fila precisa exceder o timeout de todos os jobs nela, como o Laravel exige. Caso contrário, a fila entrega um job ainda em execução a um segundo worker. - As **atividades** devem manter um timeout limitado, para que uma atividade travada não prenda um worker para sempre. Não use `--timeout=0`. -Execute as tarefas de workflow em uma conexão de fila própria, cujo -`retry_after` exceda o lease, com workers cujo `--timeout` fique abaixo do -lease. Execute as atividades em outra fila, com um timeout adequado a elas. As -atividades usam a fila do seu workflow, a menos que a classe da atividade defina -seu próprio `$connection` ou `$queue`. +Para dar às atividades um timeout menor que o das tarefas de workflow, +execute-as em uma fila própria, com workers próprios. As atividades rodam na +conexão e na fila do seu workflow, a menos que a classe da atividade defina +`$connection` ou `$queue`, ou que o workflow passe `ActivityOptions`. ```php -// config/queue.php: a connection for workflow tasks -'workflows' => [ +// config/queue.php +'redis' => [ 'driver' => 'redis', 'connection' => 'default', - 'queue' => 'workflows', - 'retry_after' => 330, // above the 300-second workflow task lease + 'queue' => 'default', + 'retry_after' => 330, // above the workflow task workers' timeout ], ``` +```php +use Workflow\V2\Activity; + +final class ChargeCardActivity extends Activity +{ + public ?string $queue = 'activities'; +} +``` + ```bash -# DW_V2_CONNECTION=workflows DW_V2_QUEUE=workflows -php artisan queue:work workflows --queue=workflows --timeout=270 -php artisan queue:work --queue=default --timeout=60 +php artisan queue:work redis --queue=default --timeout=300 # workflow tasks +php artisan queue:work redis --queue=activities --timeout=60 # activities ``` -No Horizon, a opção `timeout` de cada supervisor é o timeout do worker. Versões -mais recentes do Workflow aplicam esse timeout a todo job de tarefa de workflow -(o lease menos 30 segundos, mantido pelo menos 10 segundos abaixo de -`retry_after`), de modo que um timeout curto do worker não encerra mais tarefas -de workflow. Um worker da fila de workflows registra um aviso ao iniciar quando -`retry_after` limita as tarefas de workflow. +No Horizon, a opção `timeout` de cada supervisor é o timeout do worker. + +O Workflow 2.34.0 adiciona `DW_V2_WORKFLOW_TASK_JOB_TIMEOUT_SECONDS`, sem valor +por padrão. Quando ela é definida, todo job de tarefa de workflow carrega esse +timeout, mantido pelo menos 10 segundos abaixo do `retry_after` da sua conexão, +e os workers o usam no lugar do próprio timeout para esses jobs, de modo que +tarefas de workflow e atividades podem compartilhar workers. A partir dessa +versão, um worker que atende a fila de workflows registra um aviso ao iniciar +quando o timeout sob o qual suas tarefas de workflow rodam é menor que o lease +da tarefa de workflow. diff --git a/i18n/pt-BR/source-hashes.json b/i18n/pt-BR/source-hashes.json index 2026abbde4c..db9945da106 100644 --- a/i18n/pt-BR/source-hashes.json +++ b/i18n/pt-BR/source-hashes.json @@ -60,7 +60,7 @@ "features/webhooks.md": "edcdfc05ccb0d34a77c51594f85bc3cab343e787f8e0e08d2cd4ddebd048e8c8", "features/worker-sessions.md": "5065368fb5b93599dbd08d97cb9ac312576eb42fee14f081db663aa9f78fb68c", "how-it-works.md": "90454c37f4244297d5c11bcc59549859acf59f88d15ecd26f0a6951c115f86eb", - "installation.md": "117ba373ee55eda1ddd3c160985d686ca6b18e242228e3b63ca54869ec3705f9", + "installation.md": "8b2599dd58cda5a455c7df1ef4897521f9ec4ca823282f7446828024bce08117", "introduction.md": "06bf96d164d402d4e376c6308b20f96d324110b2e0cf96c2a1a67b39906072e3", "laravel-adoption.md": "55a4df64436667b9477c9a39dd69ddde9f4c30739ba3dfd2ff316b553a55ba4f", "mcp-workflows.md": "1c0b5bb7f2e5c7ca835dfdfa57bbe8f6624172c855f4e225057ac2377abf360e", diff --git a/i18n/uk/docusaurus-plugin-content-docs/current/installation.md b/i18n/uk/docusaurus-plugin-content-docs/current/installation.md index 815ab9f516b..3a90dbb41cd 100644 --- a/i18n/uk/docusaurus-plugin-content-docs/current/installation.md +++ b/i18n/uk/docusaurus-plugin-content-docs/current/installation.md @@ -75,49 +75,61 @@ activity. Потрібно запустити Коли PHP має розширення `pcntl`, worker черги примусово завершує будь-який job, що виконується довше за свій тайм-аут: `--timeout` worker, типово 60 секунд, -якщо job не задає власний. Завдання workflow, завершене в такий спосіб, втрачає -оренду, а його зміни відкочуються. Його буде повторено лише після спливання -оренди (`workflows.v2.workflow_task_lease_seconds`, типово 300 секунд), і -повторна спроба виконає ту саму роботу ще раз. Завдання workflow, якому завжди -потрібно більше часу, ніж дозволяє тайм-аут, наприклад завдання, що планує або -завершує широкий `all()`, ніколи не завершиться. +якщо job не задає власний. Зміни завдання workflow, завершеного в такий спосіб, +відкочуються. Його буде повторено лише після спливання його оренди +(`workflows.v2.workflow_task_lease_seconds`, типово 300 секунд), і це +зараховується як втрачена оренда; повторна спроба виконає ту саму роботу ще раз. +Завдання workflow, якому завжди потрібно більше часу, ніж дозволяє тайм-аут, +наприклад завдання, що планує або завершує широкий `all()`, ніколи не +завершиться. Три налаштування мають узгоджуватися: -- **Тайм-аут завдання workflow** має бути меншим за - **оренду завдання workflow**. Робота, що триває довше за оренду, не може - завершитися. +- **Тайм-аут worker, що виконують завдання workflow**, має покривати ваше + найдовше завдання workflow. Завершене завдання workflow чекає до кінця своєї + оренди, перш ніж його буде повторено. - **`retry_after`** з’єднання черги має перевищувати тайм-аут кожного job у цьому з’єднанні, як вимагає Laravel. Інакше черга передасть job, що ще виконується, другому worker. - **Activity** мають зберігати обмежений тайм-аут, щоб завислий activity не міг утримувати worker назавжди. Не використовуйте `--timeout=0`. -Запускайте завдання workflow в окремому з’єднанні черги, у якого `retry_after` -перевищує оренду, з worker, чий `--timeout` менший за оренду. Запускайте -activity в іншій черзі з тайм-аутом, що їм підходить. Activity використовують -чергу свого workflow, якщо клас activity не задає власні `$connection` або -`$queue`. +Щоб задати для activity коротший тайм-аут, ніж для завдань workflow, запускайте +їх в окремій черзі з окремими worker. Activity виконуються в з’єднанні та черзі +свого workflow, крім випадків, коли клас activity задає `$connection` або +`$queue` чи workflow передає `ActivityOptions`. ```php -// config/queue.php: a connection for workflow tasks -'workflows' => [ +// config/queue.php +'redis' => [ 'driver' => 'redis', 'connection' => 'default', - 'queue' => 'workflows', - 'retry_after' => 330, // above the 300-second workflow task lease + 'queue' => 'default', + 'retry_after' => 330, // above the workflow task workers' timeout ], ``` +```php +use Workflow\V2\Activity; + +final class ChargeCardActivity extends Activity +{ + public ?string $queue = 'activities'; +} +``` + ```bash -# DW_V2_CONNECTION=workflows DW_V2_QUEUE=workflows -php artisan queue:work workflows --queue=workflows --timeout=270 -php artisan queue:work --queue=default --timeout=60 +php artisan queue:work redis --queue=default --timeout=300 # workflow tasks +php artisan queue:work redis --queue=activities --timeout=60 # activities ``` -У Horizon параметр `timeout` кожного супервізора є тайм-аутом worker. Новіші -випуски Workflow задають цей тайм-аут кожному job завдання workflow (оренда -мінус 30 секунд, і щонайменше на 10 секунд менше за `retry_after`), тож короткий -тайм-аут worker більше не завершує завдання workflow. Worker у черзі workflow -під час запуску записує в журнал попередження, коли `retry_after` обмежує -завдання workflow. +У Horizon параметр `timeout` кожного супервізора є тайм-аутом worker. + +Workflow 2.34.0 додає `DW_V2_WORKFLOW_TASK_JOB_TIMEOUT_SECONDS`, типово не +заданий. Якщо його задано, кожен job завдання workflow має цей тайм-аут, +щонайменше на 10 секунд менший за `retry_after` його з’єднання, і worker +використовують його для таких job замість власного тайм-ауту, тож завдання +workflow та activity можуть спільно використовувати worker. Починаючи з цього +випуску, worker, що обслуговує чергу workflow, під час запуску записує в журнал +попередження, коли тайм-аут, з яким виконуються його завдання workflow, менший +за оренду завдання workflow. diff --git a/i18n/uk/source-hashes.json b/i18n/uk/source-hashes.json index 2026abbde4c..db9945da106 100644 --- a/i18n/uk/source-hashes.json +++ b/i18n/uk/source-hashes.json @@ -60,7 +60,7 @@ "features/webhooks.md": "edcdfc05ccb0d34a77c51594f85bc3cab343e787f8e0e08d2cd4ddebd048e8c8", "features/worker-sessions.md": "5065368fb5b93599dbd08d97cb9ac312576eb42fee14f081db663aa9f78fb68c", "how-it-works.md": "90454c37f4244297d5c11bcc59549859acf59f88d15ecd26f0a6951c115f86eb", - "installation.md": "117ba373ee55eda1ddd3c160985d686ca6b18e242228e3b63ca54869ec3705f9", + "installation.md": "8b2599dd58cda5a455c7df1ef4897521f9ec4ca823282f7446828024bce08117", "introduction.md": "06bf96d164d402d4e376c6308b20f96d324110b2e0cf96c2a1a67b39906072e3", "laravel-adoption.md": "55a4df64436667b9477c9a39dd69ddde9f4c30739ba3dfd2ff316b553a55ba4f", "mcp-workflows.md": "1c0b5bb7f2e5c7ca835dfdfa57bbe8f6624172c855f4e225057ac2377abf360e", diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/installation.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/installation.md index 3bba2830bb1..aa97ec60a7a 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/installation.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/installation.md @@ -55,30 +55,40 @@ Durable Workflow 使用队列在后台执行工作流和活动。运行 [`queue: ### Worker 超时 {#worker-timeout} -当 PHP 启用了 `pcntl` 扩展时,队列 Worker 会终止运行时间超过其超时的任何作业。这个超时就是 Worker 的 `--timeout`,默认 60 秒,除非作业设置了自己的超时。被终止的工作流任务会失去租约并被回滚。只有在租约到期(`workflows.v2.workflow_task_lease_seconds`,默认 300 秒)后才会重试,而重试会重复同样的工作。始终需要比超时更长时间的工作流任务(例如调度或完成一个大规模 `all()` 的任务)永远无法完成。 +当 PHP 启用了 `pcntl` 扩展时,队列 Worker 会终止运行时间超过其超时的任何作业。这个超时就是 Worker 的 `--timeout`,默认 60 秒,除非作业设置了自己的超时。被终止的工作流任务会被回滚。只有在其租约到期(`workflows.v2.workflow_task_lease_seconds`,默认 300 秒)后才会重试,并计为一次租约丢失,而重试会重复同样的工作。始终需要比超时更长时间的工作流任务(例如调度或完成一个大规模 `all()` 的任务)永远无法完成。 以下三项设置必须相互匹配: -- **工作流任务超时**必须小于**工作流任务租约**。运行超过租约的工作无法完成。 +- **运行工作流任务的 Worker 的超时**必须覆盖你最长的工作流任务。被终止的工作流任务要等到其租约剩余时间耗尽后才会重试。 - 队列连接的 **`retry_after`** 必须大于该连接上每个作业的超时,这是 Laravel 的要求。否则,队列会把仍在运行的作业交给第二个 Worker。 - **活动**应保留有上限的超时,以免挂起的活动永远占用 Worker。不要使用 `--timeout=0`。 -在专用的队列连接上运行工作流任务,该连接的 `retry_after` 要大于租约,Worker 的 `--timeout` 要小于租约。在另一个队列上运行活动,并使用适合它们的超时。除非活动类设置了自己的 `$connection` 或 `$queue`,活动会使用其工作流的队列。 +若要让活动的超时短于工作流任务,请在专用的队列上用专用的 Worker 运行活动。除非活动类设置了 `$connection` 或 `$queue`,或者工作流传入了 `ActivityOptions`,活动会在其工作流的连接和队列上运行。 ```php -// config/queue.php: a connection for workflow tasks -'workflows' => [ +// config/queue.php +'redis' => [ 'driver' => 'redis', 'connection' => 'default', - 'queue' => 'workflows', - 'retry_after' => 330, // above the 300-second workflow task lease + 'queue' => 'default', + 'retry_after' => 330, // above the workflow task workers' timeout ], ``` +```php +use Workflow\V2\Activity; + +final class ChargeCardActivity extends Activity +{ + public ?string $queue = 'activities'; +} +``` + ```bash -# DW_V2_CONNECTION=workflows DW_V2_QUEUE=workflows -php artisan queue:work workflows --queue=workflows --timeout=270 -php artisan queue:work --queue=default --timeout=60 +php artisan queue:work redis --queue=default --timeout=300 # workflow tasks +php artisan queue:work redis --queue=activities --timeout=60 # activities ``` -在 Horizon 中,每个 supervisor 的 `timeout` 选项就是 Worker 超时。较新的 Workflow 版本会为每个工作流任务作业设置这一超时(租约减去 30 秒,并保持比 `retry_after` 至少小 10 秒),因此较短的 Worker 超时不再会终止工作流任务。当 `retry_after` 限制了工作流任务时,工作流队列上的 Worker 会在启动时记录一条警告。 +在 Horizon 中,每个 supervisor 的 `timeout` 选项就是 Worker 超时。 + +Workflow 2.34.0 新增了 `DW_V2_WORKFLOW_TASK_JOB_TIMEOUT_SECONDS`,默认未设置。设置后,每个工作流任务作业都会带上这一超时,并保持比其连接的 `retry_after` 至少小 10 秒;Worker 会对这些作业使用该超时来代替自身的超时,因此工作流任务和活动可以共用 Worker。从该版本起,当工作流任务运行时所用的超时小于工作流任务租约时,服务工作流队列的 Worker 会在启动时记录一条警告。 diff --git a/i18n/zh-Hans/source-hashes.json b/i18n/zh-Hans/source-hashes.json index 2026abbde4c..db9945da106 100644 --- a/i18n/zh-Hans/source-hashes.json +++ b/i18n/zh-Hans/source-hashes.json @@ -60,7 +60,7 @@ "features/webhooks.md": "edcdfc05ccb0d34a77c51594f85bc3cab343e787f8e0e08d2cd4ddebd048e8c8", "features/worker-sessions.md": "5065368fb5b93599dbd08d97cb9ac312576eb42fee14f081db663aa9f78fb68c", "how-it-works.md": "90454c37f4244297d5c11bcc59549859acf59f88d15ecd26f0a6951c115f86eb", - "installation.md": "117ba373ee55eda1ddd3c160985d686ca6b18e242228e3b63ca54869ec3705f9", + "installation.md": "8b2599dd58cda5a455c7df1ef4897521f9ec4ca823282f7446828024bce08117", "introduction.md": "06bf96d164d402d4e376c6308b20f96d324110b2e0cf96c2a1a67b39906072e3", "laravel-adoption.md": "55a4df64436667b9477c9a39dd69ddde9f4c30739ba3dfd2ff316b553a55ba4f", "mcp-workflows.md": "1c0b5bb7f2e5c7ca835dfdfa57bbe8f6624172c855f4e225057ac2377abf360e",