Skip to content

Native: wait DW_WORKER_POLL_TIMEOUT on polls and check operation names like PHP - #669

Merged
rmcdaniel merged 2 commits into
mainfrom
rust-325-poll-wait
Oct 23, 2026
Merged

rmcdaniel merged 2 commits into
mainfrom
rust-325-poll-wait

Conversation

@rmcdaniel

Copy link
Copy Markdown
Member

Part of #325.

Poll waits. Server 2.10.0's LongPoller: a workflow or activity poll without timeout_seconds waits max(0, DW_WORKER_POLL_TIMEOUT) seconds, 30 by default. Native waited 5.

  • A query-task poll starts from the same setting, capped by DW_QUERY_TASK_POLL_TIMEOUT (queryPollTimeoutSeconds).
  • An explicit null wait takes the default, as PHP's nullable rule allows.
  • A requested wait follows Laravel's integer rule, from 0 to 60. The setting itself is not capped.

Operation names. Signal, update and query requests now run PHP's validateOperationName first. Empty names, names over 256 bytes and names with control characters get PHP's validation_failed messages.

PHP's signal and update name columns hold 255 bytes, so PHP stores a 256-byte name on SQLite and fails with a database error on MySQL and PostgreSQL. Native keeps its storage guard (invalid_signal_name / invalid_update_name) for those names and for names of only spaces. The gap list records this.

Fixed along the way. A query poll from a worker registered without capabilities answered 503 storage_unavailable. It now polls empty, as PHP's stringArray does.

Tests (tests/execution/poll_waits.rs):

  • default, null, zero and string waits;
  • refused waits;
  • a task claimed during a default wait;
  • name validation per kind, including 255- and 256-byte names.

Results.

  • SQLite, all targets: 228 unit, 397 execution and 2 upgrade tests passed.
  • Poll, signal, update and query tests: PostgreSQL 122, MySQL 122.

Checkpoint: docs/rust-server-port-checkpoints/2026-10-22-poll-waits.md.

A workflow or activity poll without timeout_seconds now waits
max(0, DW_WORKER_POLL_TIMEOUT) seconds (30 by default), as Server 2.10.0's
LongPoller does, instead of 5. A query-task poll starts from the same
setting, capped by DW_QUERY_TASK_POLL_TIMEOUT. An explicit null wait takes
the default, and a requested wait follows Laravel's integer rule from 0 to
60.

Signal, update and query names get PHP's validateOperationName errors:
empty, over 256 bytes or with control characters. Native keeps its
255-byte storage guard for signal and update names, which PHP's own
columns cannot exceed.

A query poll from a worker registered without capabilities answered 503;
it now polls empty, as PHP does.
@sonarqubecloud

Copy link
Copy Markdown

@rmcdaniel

Copy link
Copy Markdown
Member Author

Riding merge train #675 with #667, #669, #670 and #674 on main 17dc12cd, so they share one CI run. This PR closes with a link once the train merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant