From 851c10c3b8a226869123563c2bd3ad94b3d7826e Mon Sep 17 00:00:00 2001 From: Durable Workflow Date: Thu, 22 Oct 2026 09:50:36 +0000 Subject: [PATCH 1/2] docs: explain legacy overlap delay and queue attempts in every locale --- docs/configuration/options.md | 16 ++++++++++++++++ .../current/configuration/options.md | 16 ++++++++++++++++ i18n/de/source-hashes.json | 2 +- .../current/configuration/options.md | 16 ++++++++++++++++ i18n/es/source-hashes.json | 2 +- .../current/configuration/options.md | 16 ++++++++++++++++ i18n/fr/source-hashes.json | 2 +- .../current/configuration/options.md | 16 ++++++++++++++++ i18n/ja/source-hashes.json | 2 +- .../current/configuration/options.md | 16 ++++++++++++++++ i18n/pt-BR/source-hashes.json | 2 +- .../current/configuration/options.md | 16 ++++++++++++++++ i18n/uk/source-hashes.json | 2 +- .../current/configuration/options.md | 16 ++++++++++++++++ i18n/zh-Hans/source-hashes.json | 2 +- .../version-1.x/configuration/options.md | 16 ++++++++++++++++ 16 files changed, 151 insertions(+), 7 deletions(-) diff --git a/docs/configuration/options.md b/docs/configuration/options.md index 58a6e1ab42d..770da94e634 100644 --- a/docs/configuration/options.md +++ b/docs/configuration/options.md @@ -215,3 +215,19 @@ For imported v1 failures that were recorded before an exception alias existed, ` Final v2 writes durable exception aliases when the failure is recorded, so configure stable aliases before recording failures whose throwable classes may move later. If a replayed failure cannot be resolved through the durable `exceptions` map, the class-alias map, or the recorded class, the engine does not fall back to a generic runtime exception inside workflow code. Query replay raises `UnresolvedWorkflowFailureException`, Waterline marks the failure with `exception_replay_blocked = true`, and a worker task that hits the same gap is left failed while the run stays open. Fix the mapping and repair the run rather than relying on broad `catch (RuntimeException)` blocks to handle renamed historical failures. + +## Legacy workflow overlap delay {#legacy-overlap-release-delay} + +For applications using `Workflow\Workflow`, set `overlapReleaseAfter` to a nonnegative integer number of seconds. The default is `0`. This setting applies to contended workflow, activity, signal and child-completion queue jobs. It does not change lock expiry or activity exception backoff. `Workflow\V2\Workflow` uses task claims and does not use this middleware. + +```php +use Workflow\WorkflowOptions; +use Workflow\WorkflowStub; + +$workflow = WorkflowStub::make(MyLegacyWorkflow::class); +$workflow->start('argument', new WorkflowOptions(overlapReleaseAfter: 5)); +``` + +`WorkflowOptions::set(['overlapReleaseAfter' => 5])` accepts the same setting. The value is persisted with the run and inherited by children and continue-as-new when no explicit `WorkflowOptions` is supplied. An explicit options object replaces inherited options, including resetting this delay to zero if omitted. + +Laravel counts queue reservations as attempts even when middleware releases a job before its handler runs. A positive delay reduces rapid retries but cannot guarantee that a low `$tries`, `--tries`, or database queue attempt limit is safe. Choose the delay and retry budget for the expected contention duration. diff --git a/i18n/de/docusaurus-plugin-content-docs/current/configuration/options.md b/i18n/de/docusaurus-plugin-content-docs/current/configuration/options.md index 9496e176a94..7228a8e7a4b 100644 --- a/i18n/de/docusaurus-plugin-content-docs/current/configuration/options.md +++ b/i18n/de/docusaurus-plugin-content-docs/current/configuration/options.md @@ -312,3 +312,19 @@ Eine Worker-Aufgabe mit derselben Lücke bleibt fehlgeschlagen, während die Ausführung offen bleibt. Korrigieren Sie die Zuordnung und reparieren Sie die Ausführung, statt umbenannte historische Fehler über breite `catch (RuntimeException)`-Blöcke behandeln zu wollen. + +## Wartezeit bei belegten Sperren für bisherige Workflows {#legacy-overlap-release-delay} + +Für Anwendungen mit `Workflow\Workflow` legt `overlapReleaseAfter` die Wartezeit als nichtnegative ganze Zahl in Sekunden fest. Der Standardwert ist `0`. Die Einstellung gilt für Queue-Jobs von Workflows, Aktivitäten, Signalen und Kindworkflow-Ergebnissen, deren Sperre belegt ist. Sie ändert weder die Gültigkeitsdauer der Sperre noch den Backoff nach Aktivitätsausnahmen. `Workflow\V2\Workflow` verwendet Task-Claims und diese Middleware nicht. + +```php +use Workflow\WorkflowOptions; +use Workflow\WorkflowStub; + +$workflow = WorkflowStub::make(MyLegacyWorkflow::class); +$workflow->start('argument', new WorkflowOptions(overlapReleaseAfter: 5)); +``` + +`WorkflowOptions::set(['overlapReleaseAfter' => 5])` akzeptiert dieselbe Einstellung. Der Wert wird mit dem Lauf gespeichert. Kindworkflows und continue-as-new übernehmen ihn, wenn kein explizites `WorkflowOptions` übergeben wird. Ein explizites Optionsobjekt ersetzt die geerbten Optionen und setzt diese Wartezeit auf null Sekunden zurück, wenn sie darin fehlt. + +Laravel zählt Queue-Reservierungen als Versuche, auch wenn die Middleware den Job vor der Verarbeitung zurückstellt. Eine positive Wartezeit verringert schnelle Wiederholungen, garantiert aber nicht, dass niedrige Grenzwerte für `$tries`, `--tries` oder den Versuchszähler der Datenbank-Queue ausreichen. Wählen Sie Wartezeit und Versuchslimit passend zur erwarteten Dauer der Sperrkonkurrenz. diff --git a/i18n/de/source-hashes.json b/i18n/de/source-hashes.json index 5cd0d13fed9..b1aa824ff31 100644 --- a/i18n/de/source-hashes.json +++ b/i18n/de/source-hashes.json @@ -9,7 +9,7 @@ "configuration/database-connection.md": "a4657d239673a4ecdc3981bcc5a7cf33aa2d37c709768131cd5ba3292987681f", "configuration/ensuring-same-server.md": "6c665f37cc198c7b1a775a60a94aab5ff4e55383385e76f1834c7840559b512a", "configuration/microservices.md": "46dc4afa07588b78829a7e3d259177ce0cf40861f0e31b88dbb6de3a83aa5488", - "configuration/options.md": "b8b5f1e9f425e3a8be2e76bc6c0a75ec004567f57dfea55135831660029e1cd0", + "configuration/options.md": "87622f9947b0042d1680197e612daf20a54ab6292a12d30e1077ba65f411e80c", "configuration/pruning-workflows.md": "51366f3553f6556a15518a9c5a0ac6b009aa11ad5150269b87141b8f0adb57ea", "configuration/publishing-config.md": "c757acd749c0d2696a6e19484249c9298dd15970ce0cf2ae0e6d2dfd82c8b6d6", "constraints/activity-constraints.md": "5a953d0e95e750b6c02d1c72b72199fb3ff4687540cebc56aa3b216cf667bb05", diff --git a/i18n/es/docusaurus-plugin-content-docs/current/configuration/options.md b/i18n/es/docusaurus-plugin-content-docs/current/configuration/options.md index afa5f784b1e..a9f63429c81 100644 --- a/i18n/es/docusaurus-plugin-content-docs/current/configuration/options.md +++ b/i18n/es/docusaurus-plugin-content-docs/current/configuration/options.md @@ -215,3 +215,19 @@ Para fallos v1 importados que se registraron antes de existir un alias, `workflo La versión final de v2 escribe alias duraderos al registrar el fallo. Configura alias estables antes de registrar fallos cuyas clases de throwable puedan moverse después. Si un fallo reproducido no puede resolverse con el mapa duradero `exceptions`, el mapa de alias de clase ni la clase registrada, el motor no recurre a una excepción genérica dentro del workflow. La reproducción de consultas lanza `UnresolvedWorkflowFailureException`, Waterline marca el fallo con `exception_replay_blocked = true` y una tarea de worker que encuentre el mismo problema queda fallida mientras la ejecución permanece abierta. Corrige el mapa y repara la ejecución en lugar de usar bloques amplios `catch (RuntimeException)` para fallos históricos renombrados. + +## Espera por bloqueo en workflows de la API anterior {#legacy-overlap-release-delay} + +En aplicaciones que usan `Workflow\Workflow`, configure `overlapReleaseAfter` con un número entero de segundos mayor o igual que cero. El valor predeterminado es `0`. Se aplica a los trabajos de workflow, actividad, señal y resultado de workflow hijo que no pueden adquirir su bloqueo. No cambia la caducidad del bloqueo ni la espera tras excepciones de actividad. `Workflow\V2\Workflow` usa reservas de tareas y no utiliza este middleware. + +```php +use Workflow\WorkflowOptions; +use Workflow\WorkflowStub; + +$workflow = WorkflowStub::make(MyLegacyWorkflow::class); +$workflow->start('argument', new WorkflowOptions(overlapReleaseAfter: 5)); +``` + +`WorkflowOptions::set(['overlapReleaseAfter' => 5])` admite la misma configuración. El valor se guarda con la ejecución y se hereda en los hijos y en continue-as-new cuando no se proporciona un `WorkflowOptions` explícito. Un objeto de opciones explícito sustituye las opciones heredadas y restablece esta espera a cero si se omite. + +Laravel cuenta las reservas de la cola como intentos, incluso cuando el middleware devuelve el trabajo a la cola antes de ejecutarlo. Una espera positiva reduce los reintentos rápidos, pero no garantiza que un límite bajo de `$tries`, `--tries` o del contador de intentos de la cola en base de datos sea suficiente. Elija la espera y el límite de intentos según la duración prevista de la contención. diff --git a/i18n/es/source-hashes.json b/i18n/es/source-hashes.json index 5cd0d13fed9..b1aa824ff31 100644 --- a/i18n/es/source-hashes.json +++ b/i18n/es/source-hashes.json @@ -9,7 +9,7 @@ "configuration/database-connection.md": "a4657d239673a4ecdc3981bcc5a7cf33aa2d37c709768131cd5ba3292987681f", "configuration/ensuring-same-server.md": "6c665f37cc198c7b1a775a60a94aab5ff4e55383385e76f1834c7840559b512a", "configuration/microservices.md": "46dc4afa07588b78829a7e3d259177ce0cf40861f0e31b88dbb6de3a83aa5488", - "configuration/options.md": "b8b5f1e9f425e3a8be2e76bc6c0a75ec004567f57dfea55135831660029e1cd0", + "configuration/options.md": "87622f9947b0042d1680197e612daf20a54ab6292a12d30e1077ba65f411e80c", "configuration/pruning-workflows.md": "51366f3553f6556a15518a9c5a0ac6b009aa11ad5150269b87141b8f0adb57ea", "configuration/publishing-config.md": "c757acd749c0d2696a6e19484249c9298dd15970ce0cf2ae0e6d2dfd82c8b6d6", "constraints/activity-constraints.md": "5a953d0e95e750b6c02d1c72b72199fb3ff4687540cebc56aa3b216cf667bb05", diff --git a/i18n/fr/docusaurus-plugin-content-docs/current/configuration/options.md b/i18n/fr/docusaurus-plugin-content-docs/current/configuration/options.md index 2e8bb35c488..e2d0e98e595 100644 --- a/i18n/fr/docusaurus-plugin-content-docs/current/configuration/options.md +++ b/i18n/fr/docusaurus-plugin-content-docs/current/configuration/options.md @@ -215,3 +215,19 @@ Pour les échecs v1 importés et enregistrés avant l’existence d’un alias d La version finale v2 écrit les alias d’exception durables lors de l’enregistrement de l’échec. Configurez donc des alias stables avant d’enregistrer des échecs dont les classes d’exception pourraient être déplacées. Si un échec relu ne peut être résolu ni par la table durable `exceptions`, ni par les alias de classes, ni par la classe enregistrée, le moteur ne le remplace pas par une exception générique dans le code du workflow. La relecture d’une requête de lecture lève `UnresolvedWorkflowFailureException`, Waterline marque l’échec avec `exception_replay_blocked = true`, et une tâche de worker rencontrant la même absence reste en échec tandis que l’exécution reste ouverte. Corrigez l’association et réparez l’exécution au lieu de compter sur des blocs généraux `catch (RuntimeException)` pour traiter les échecs historiques renommés. + +## Délai en cas de verrou occupé pour les workflows historiques {#legacy-overlap-release-delay} + +Pour les applications utilisant `Workflow\Workflow`, définissez `overlapReleaseAfter` comme un nombre entier positif ou nul de secondes. La valeur par défaut est `0`. Ce réglage s’applique aux tâches de workflow, d’activité, de signal et de résultat enfant dont le verrou est occupé. Il ne modifie ni l’expiration des verrous ni le délai après exception d’une activité. `Workflow\V2\Workflow` utilise des prises en charge de tâches et non ce middleware. + +```php +use Workflow\WorkflowOptions; +use Workflow\WorkflowStub; + +$workflow = WorkflowStub::make(MyLegacyWorkflow::class); +$workflow->start('argument', new WorkflowOptions(overlapReleaseAfter: 5)); +``` + +`WorkflowOptions::set(['overlapReleaseAfter' => 5])` accepte le même réglage. La valeur est enregistrée avec l’exécution et transmise aux enfants et à continue-as-new si aucun `WorkflowOptions` explicite n’est fourni. Un objet d’options explicite remplace les options héritées et remet ce délai à zéro s’il est omis. + +Laravel compte les réservations dans la file comme des tentatives, même si le middleware libère la tâche avant son traitement. Un délai positif réduit les nouvelles tentatives immédiates, mais ne garantit pas qu’une limite basse de `$tries`, de `--tries` ou du compteur de tentatives de la file en base soit suffisante. Adaptez le délai et le nombre de tentatives à la durée de contention attendue. diff --git a/i18n/fr/source-hashes.json b/i18n/fr/source-hashes.json index 5cd0d13fed9..b1aa824ff31 100644 --- a/i18n/fr/source-hashes.json +++ b/i18n/fr/source-hashes.json @@ -9,7 +9,7 @@ "configuration/database-connection.md": "a4657d239673a4ecdc3981bcc5a7cf33aa2d37c709768131cd5ba3292987681f", "configuration/ensuring-same-server.md": "6c665f37cc198c7b1a775a60a94aab5ff4e55383385e76f1834c7840559b512a", "configuration/microservices.md": "46dc4afa07588b78829a7e3d259177ce0cf40861f0e31b88dbb6de3a83aa5488", - "configuration/options.md": "b8b5f1e9f425e3a8be2e76bc6c0a75ec004567f57dfea55135831660029e1cd0", + "configuration/options.md": "87622f9947b0042d1680197e612daf20a54ab6292a12d30e1077ba65f411e80c", "configuration/pruning-workflows.md": "51366f3553f6556a15518a9c5a0ac6b009aa11ad5150269b87141b8f0adb57ea", "configuration/publishing-config.md": "c757acd749c0d2696a6e19484249c9298dd15970ce0cf2ae0e6d2dfd82c8b6d6", "constraints/activity-constraints.md": "5a953d0e95e750b6c02d1c72b72199fb3ff4687540cebc56aa3b216cf667bb05", diff --git a/i18n/ja/docusaurus-plugin-content-docs/current/configuration/options.md b/i18n/ja/docusaurus-plugin-content-docs/current/configuration/options.md index 2872faf4bd6..f327d369fc9 100644 --- a/i18n/ja/docusaurus-plugin-content-docs/current/configuration/options.md +++ b/i18n/ja/docusaurus-plugin-content-docs/current/configuration/options.md @@ -215,3 +215,19 @@ $tasks = $bridge->poll('redis', 'default', limit: 10, namespace: 'production'); 正式版 v2 は失敗記録時に永続的な例外エイリアスを書き込みます。後で throwable クラスを移動する可能性がある失敗を記録する前に、安定したエイリアスを設定してください。 リプレイする失敗を永続的な `exceptions` マップ、クラスエイリアスマップ、記録済みクラスで解決できない場合、エンジンはワークフロー内で汎用ランタイム例外にフォールバックしません。クエリのリプレイは `UnresolvedWorkflowFailureException` を投げ、Waterline は `exception_replay_blocked = true` を表示します。同じ問題に遭遇した Worker タスクは失敗したまま、実行は開いたままになります。名前を変更した過去の失敗を広い `catch (RuntimeException)` に頼って処理せず、マッピングを直して実行を修復してください。 + +## 旧APIのワークフローでロック競合時の遅延を設定する {#legacy-overlap-release-delay} + +`Workflow\Workflow` を使うアプリケーションでは、`overlapReleaseAfter` に秒単位の非負整数を指定します。既定値は `0` です。この設定は、ロックを取得できないワークフロー、アクティビティ、シグナル、子ワークフローの結果通知のキュージョブに適用されます。ロックの有効期限やアクティビティ例外後のバックオフは変わりません。`Workflow\V2\Workflow` はタスクの取得権を使い、このミドルウェアは使用しません。 + +```php +use Workflow\WorkflowOptions; +use Workflow\WorkflowStub; + +$workflow = WorkflowStub::make(MyLegacyWorkflow::class); +$workflow->start('argument', new WorkflowOptions(overlapReleaseAfter: 5)); +``` + +`WorkflowOptions::set(['overlapReleaseAfter' => 5])` でも同じ設定ができます。この値は実行とともに永続化され、明示的な `WorkflowOptions` を渡さなければ、子ワークフローと continue-as-new に引き継がれます。明示的なオプションオブジェクトは継承した設定を置き換え、この遅延を省略するとゼロに戻します。 + +Laravel は、ミドルウェアがハンドラーの実行前にジョブをキューへ戻した場合も、キューの予約を試行として数えます。正の遅延は短時間の再試行を減らしますが、小さい `$tries`、`--tries`、またはデータベースキューの試行回数上限で十分とは限りません。想定するロック競合の継続時間に合わせて、遅延と試行回数を設定してください。 diff --git a/i18n/ja/source-hashes.json b/i18n/ja/source-hashes.json index 5cd0d13fed9..b1aa824ff31 100644 --- a/i18n/ja/source-hashes.json +++ b/i18n/ja/source-hashes.json @@ -9,7 +9,7 @@ "configuration/database-connection.md": "a4657d239673a4ecdc3981bcc5a7cf33aa2d37c709768131cd5ba3292987681f", "configuration/ensuring-same-server.md": "6c665f37cc198c7b1a775a60a94aab5ff4e55383385e76f1834c7840559b512a", "configuration/microservices.md": "46dc4afa07588b78829a7e3d259177ce0cf40861f0e31b88dbb6de3a83aa5488", - "configuration/options.md": "b8b5f1e9f425e3a8be2e76bc6c0a75ec004567f57dfea55135831660029e1cd0", + "configuration/options.md": "87622f9947b0042d1680197e612daf20a54ab6292a12d30e1077ba65f411e80c", "configuration/pruning-workflows.md": "51366f3553f6556a15518a9c5a0ac6b009aa11ad5150269b87141b8f0adb57ea", "configuration/publishing-config.md": "c757acd749c0d2696a6e19484249c9298dd15970ce0cf2ae0e6d2dfd82c8b6d6", "constraints/activity-constraints.md": "5a953d0e95e750b6c02d1c72b72199fb3ff4687540cebc56aa3b216cf667bb05", diff --git a/i18n/pt-BR/docusaurus-plugin-content-docs/current/configuration/options.md b/i18n/pt-BR/docusaurus-plugin-content-docs/current/configuration/options.md index 75bddfbd8fd..12f68e06321 100644 --- a/i18n/pt-BR/docusaurus-plugin-content-docs/current/configuration/options.md +++ b/i18n/pt-BR/docusaurus-plugin-content-docs/current/configuration/options.md @@ -215,3 +215,19 @@ Para falhas importadas da v1 que foram registradas antes de existir um alias de A v2 final grava aliases duráveis de exceção quando a falha é registrada. Portanto, configure aliases estáveis antes de registrar falhas cujas classes lançáveis possam mudar de localização depois. Se uma falha durante o replay não puder ser resolvida pelo mapa durável `exceptions`, pelo mapa de aliases de classe ou pela classe registrada, o mecanismo não recorre a uma exceção genérica de runtime dentro do código do workflow. O replay de consulta lança `UnresolvedWorkflowFailureException`, o Waterline marca a falha com `exception_replay_blocked = true`, e uma tarefa de worker que encontre a mesma lacuna fica com falha enquanto a execução permanece aberta. Corrija o mapeamento e repare a execução em vez de depender de blocos amplos de `catch (RuntimeException)` para tratar falhas históricas renomeadas. + +## Espera por bloqueio em workflows da API anterior {#legacy-overlap-release-delay} + +Em aplicações que usam `Workflow\Workflow`, defina `overlapReleaseAfter` como um número inteiro de segundos maior ou igual a zero. O padrão é `0`. A configuração se aplica aos jobs de workflow, atividade, sinal e resultado de workflow filho que não conseguem obter o bloqueio. Ela não altera a expiração do bloqueio nem o backoff após exceções de atividade. `Workflow\V2\Workflow` usa reservas de tarefas e não utiliza esse middleware. + +```php +use Workflow\WorkflowOptions; +use Workflow\WorkflowStub; + +$workflow = WorkflowStub::make(MyLegacyWorkflow::class); +$workflow->start('argument', new WorkflowOptions(overlapReleaseAfter: 5)); +``` + +`WorkflowOptions::set(['overlapReleaseAfter' => 5])` aceita a mesma configuração. O valor é salvo com a execução e herdado pelos filhos e por continue-as-new quando nenhum `WorkflowOptions` explícito é fornecido. Um objeto de opções explícito substitui as opções herdadas e redefine essa espera para zero se ela for omitida. + +O Laravel conta as reservas da fila como tentativas, mesmo quando o middleware devolve o job à fila antes da execução. Uma espera positiva reduz as novas tentativas imediatas, mas não garante que um limite baixo de `$tries`, `--tries` ou do contador de tentativas da fila em banco de dados seja suficiente. Escolha a espera e o limite de tentativas conforme a duração esperada da contenção. diff --git a/i18n/pt-BR/source-hashes.json b/i18n/pt-BR/source-hashes.json index 5cd0d13fed9..b1aa824ff31 100644 --- a/i18n/pt-BR/source-hashes.json +++ b/i18n/pt-BR/source-hashes.json @@ -9,7 +9,7 @@ "configuration/database-connection.md": "a4657d239673a4ecdc3981bcc5a7cf33aa2d37c709768131cd5ba3292987681f", "configuration/ensuring-same-server.md": "6c665f37cc198c7b1a775a60a94aab5ff4e55383385e76f1834c7840559b512a", "configuration/microservices.md": "46dc4afa07588b78829a7e3d259177ce0cf40861f0e31b88dbb6de3a83aa5488", - "configuration/options.md": "b8b5f1e9f425e3a8be2e76bc6c0a75ec004567f57dfea55135831660029e1cd0", + "configuration/options.md": "87622f9947b0042d1680197e612daf20a54ab6292a12d30e1077ba65f411e80c", "configuration/pruning-workflows.md": "51366f3553f6556a15518a9c5a0ac6b009aa11ad5150269b87141b8f0adb57ea", "configuration/publishing-config.md": "c757acd749c0d2696a6e19484249c9298dd15970ce0cf2ae0e6d2dfd82c8b6d6", "constraints/activity-constraints.md": "5a953d0e95e750b6c02d1c72b72199fb3ff4687540cebc56aa3b216cf667bb05", diff --git a/i18n/uk/docusaurus-plugin-content-docs/current/configuration/options.md b/i18n/uk/docusaurus-plugin-content-docs/current/configuration/options.md index f6becf75d2e..13d69a1ed57 100644 --- a/i18n/uk/docusaurus-plugin-content-docs/current/configuration/options.md +++ b/i18n/uk/docusaurus-plugin-content-docs/current/configuration/options.md @@ -215,3 +215,19 @@ $tasks = $bridge->poll('redis', 'default', limit: 10, namespace: 'production'); Фінальна v2 записує стійкі псевдоніми винятків під час запису помилки. Тому налаштуйте стабільні псевдоніми до запису помилок, класи яких можуть згодом переміститися. Якщо помилку під час відтворення не можна визначити через стійку мапу `exceptions`, мапу псевдонімів класів чи записаний клас, рушій не підміняє її загальним винятком виконання в коді workflow. Відтворення query викидає `UnresolvedWorkflowFailureException`, Waterline позначає помилку як `exception_replay_blocked = true`, а завдання worker з тією самою прогалиною залишається невдалим, поки запуск відкритий. Виправте зіставлення та відновіть запуск, замість покладання на загальні блоки `catch (RuntimeException)` для перейменованих історичних помилок. + +## Затримка при зайнятому блокуванні для попереднього API workflow {#legacy-overlap-release-delay} + +Для застосунків із `Workflow\Workflow` задайте `overlapReleaseAfter` як ціле невід’ємне число секунд. Типове значення — `0`. Налаштування застосовується до завдань черги для workflow, activity, signal і результатів дочірніх workflow, які не можуть отримати блокування. Воно не змінює строк дії блокування або затримку після винятків activity. `Workflow\V2\Workflow` використовує резервування завдань, а не цей middleware. + +```php +use Workflow\WorkflowOptions; +use Workflow\WorkflowStub; + +$workflow = WorkflowStub::make(MyLegacyWorkflow::class); +$workflow->start('argument', new WorkflowOptions(overlapReleaseAfter: 5)); +``` + +`WorkflowOptions::set(['overlapReleaseAfter' => 5])` приймає те саме налаштування. Значення зберігається з виконанням і успадковується дочірніми workflow та continue-as-new, якщо не передано явний `WorkflowOptions`. Явний об’єкт опцій замінює успадковані опції й скидає цю затримку до нуля, якщо її не вказано. + +Laravel рахує резервування в черзі як спроби, навіть якщо middleware повертає завдання в чергу до запуску обробника. Додатна затримка зменшує кількість швидких повторів, але не гарантує достатності малого ліміту `$tries`, `--tries` або лічильника спроб черги в базі даних. Обирайте затримку та ліміт спроб відповідно до очікуваної тривалості конкуренції за блокування. diff --git a/i18n/uk/source-hashes.json b/i18n/uk/source-hashes.json index 5cd0d13fed9..b1aa824ff31 100644 --- a/i18n/uk/source-hashes.json +++ b/i18n/uk/source-hashes.json @@ -9,7 +9,7 @@ "configuration/database-connection.md": "a4657d239673a4ecdc3981bcc5a7cf33aa2d37c709768131cd5ba3292987681f", "configuration/ensuring-same-server.md": "6c665f37cc198c7b1a775a60a94aab5ff4e55383385e76f1834c7840559b512a", "configuration/microservices.md": "46dc4afa07588b78829a7e3d259177ce0cf40861f0e31b88dbb6de3a83aa5488", - "configuration/options.md": "b8b5f1e9f425e3a8be2e76bc6c0a75ec004567f57dfea55135831660029e1cd0", + "configuration/options.md": "87622f9947b0042d1680197e612daf20a54ab6292a12d30e1077ba65f411e80c", "configuration/pruning-workflows.md": "51366f3553f6556a15518a9c5a0ac6b009aa11ad5150269b87141b8f0adb57ea", "configuration/publishing-config.md": "c757acd749c0d2696a6e19484249c9298dd15970ce0cf2ae0e6d2dfd82c8b6d6", "constraints/activity-constraints.md": "5a953d0e95e750b6c02d1c72b72199fb3ff4687540cebc56aa3b216cf667bb05", diff --git a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/configuration/options.md b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/configuration/options.md index d3ed605a292..bdceac1fa9f 100644 --- a/i18n/zh-Hans/docusaurus-plugin-content-docs/current/configuration/options.md +++ b/i18n/zh-Hans/docusaurus-plugin-content-docs/current/configuration/options.md @@ -215,3 +215,19 @@ $tasks = $bridge->poll('redis', 'default', limit: 10, namespace: 'production'); 最终版 v2 在记录故障时写入持久异常别名,因此,对以后可能移动可抛出类的故障,应在记录前配置稳定别名。 如果重放的故障无法通过持久 `exceptions` 映射、类别名映射或记录的类解析,引擎不会在工作流代码中回退为通用运行时异常。查询重放会抛出 `UnresolvedWorkflowFailureException`,Waterline 将故障标记为 `exception_replay_blocked = true`,遇到同样缺口的 Worker 任务会保持失败,而运行仍保持打开。请修正映射并修复运行,不要依赖宽泛的 `catch (RuntimeException)` 来处理已重命名的历史故障。 + +## 旧版工作流的锁竞争重试延迟 {#legacy-overlap-release-delay} + +对于使用 `Workflow\Workflow` 的应用,将 `overlapReleaseAfter` 设置为以秒为单位的非负整数,默认值为 `0`。此设置适用于因锁被占用而无法执行的工作流、活动、信号和子工作流结果队列任务。它不会改变锁的过期时间或活动异常后的退避时间。`Workflow\V2\Workflow` 使用任务认领机制,不使用此中间件。 + +```php +use Workflow\WorkflowOptions; +use Workflow\WorkflowStub; + +$workflow = WorkflowStub::make(MyLegacyWorkflow::class); +$workflow->start('argument', new WorkflowOptions(overlapReleaseAfter: 5)); +``` + +`WorkflowOptions::set(['overlapReleaseAfter' => 5])` 也接受此设置。该值随运行一起持久化;如果没有显式传入 `WorkflowOptions`,子工作流和 continue-as-new 会继承它。显式选项对象会替换继承的选项,如果其中未指定此延迟,则重置为零。 + +即使中间件在处理程序运行前就将任务放回队列,Laravel 仍会将队列预留计为一次尝试。正延迟可以减少快速重试,但不能保证较低的 `$tries`、`--tries` 或数据库队列尝试次数上限足够。请根据预计的锁竞争持续时间选择延迟和尝试次数预算。 diff --git a/i18n/zh-Hans/source-hashes.json b/i18n/zh-Hans/source-hashes.json index 5cd0d13fed9..b1aa824ff31 100644 --- a/i18n/zh-Hans/source-hashes.json +++ b/i18n/zh-Hans/source-hashes.json @@ -9,7 +9,7 @@ "configuration/database-connection.md": "a4657d239673a4ecdc3981bcc5a7cf33aa2d37c709768131cd5ba3292987681f", "configuration/ensuring-same-server.md": "6c665f37cc198c7b1a775a60a94aab5ff4e55383385e76f1834c7840559b512a", "configuration/microservices.md": "46dc4afa07588b78829a7e3d259177ce0cf40861f0e31b88dbb6de3a83aa5488", - "configuration/options.md": "b8b5f1e9f425e3a8be2e76bc6c0a75ec004567f57dfea55135831660029e1cd0", + "configuration/options.md": "87622f9947b0042d1680197e612daf20a54ab6292a12d30e1077ba65f411e80c", "configuration/pruning-workflows.md": "51366f3553f6556a15518a9c5a0ac6b009aa11ad5150269b87141b8f0adb57ea", "configuration/publishing-config.md": "c757acd749c0d2696a6e19484249c9298dd15970ce0cf2ae0e6d2dfd82c8b6d6", "constraints/activity-constraints.md": "5a953d0e95e750b6c02d1c72b72199fb3ff4687540cebc56aa3b216cf667bb05", diff --git a/versioned_docs/version-1.x/configuration/options.md b/versioned_docs/version-1.x/configuration/options.md index 962adf486d6..dea4b929e92 100644 --- a/versioned_docs/version-1.x/configuration/options.md +++ b/versioned_docs/version-1.x/configuration/options.md @@ -70,3 +70,19 @@ The `$timeout` setting is used to control the maximum number of seconds an activ ## Backoff The `backoff` method returns an array of integers corresponding to the current attempt. The default `backoff` method decays exponentially to 2 minutes. This can be overridden by implementing the `backoff` method on the activity class. + +## Legacy workflow overlap delay {#legacy-overlap-release-delay} + +For applications using `Workflow\Workflow`, set `overlapReleaseAfter` to a nonnegative integer number of seconds. The default is `0`. This setting applies to contended workflow, activity, signal and child-completion queue jobs. It does not change lock expiry or activity exception backoff. `Workflow\V2\Workflow` uses task claims and does not use this middleware. + +```php +use Workflow\WorkflowOptions; +use Workflow\WorkflowStub; + +$workflow = WorkflowStub::make(MyLegacyWorkflow::class); +$workflow->start('argument', new WorkflowOptions(overlapReleaseAfter: 5)); +``` + +`WorkflowOptions::set(['overlapReleaseAfter' => 5])` accepts the same setting. The value is persisted with the run and inherited by children and continue-as-new when no explicit `WorkflowOptions` is supplied. An explicit options object replaces inherited options, including resetting this delay to zero if omitted. + +Laravel counts queue reservations as attempts even when middleware releases a job before its handler runs. A positive delay reduces rapid retries but cannot guarantee that a low `$tries`, `--tries`, or database queue attempt limit is safe. Choose the delay and retry budget for the expected contention duration. From 5355d2e1b4141f00d91bb620f4f5be492edbf8be Mon Sep 17 00:00:00 2001 From: Durable Workflow Date: Thu, 22 Oct 2026 11:03:39 +0000 Subject: [PATCH 2/2] docs: pin published Core 2.11.0 for overlap guidance --- static/stable-releases.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/static/stable-releases.json b/static/stable-releases.json index 0954f1141c3..15b8507195c 100644 --- a/static/stable-releases.json +++ b/static/stable-releases.json @@ -1,7 +1,7 @@ { "schema": "durable-workflow.docs.stable-releases", "schema_version": 1, - "updated_at": "2026-10-21", + "updated_at": "2026-10-22", "artifacts": { "cli": "2.3.0", "sdk-php": "3.2.0", @@ -9,6 +9,6 @@ "sdk-rust": "4.2.0", "server": "2.10.1", "waterline": "2.12.1", - "workflow": "2.10.1" + "workflow": "2.11.0" } }