Skip to content

Commit c389077

Browse files
Refresh sample-app workflow lock for 2.0.0-alpha.236 (#307)
1 parent 549428f commit c389077

7 files changed

Lines changed: 55 additions & 22 deletions

File tree

app/Console/Commands/PolyglotWorker.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646
*/
4747
class PolyglotWorker extends Command
4848
{
49+
private const QUERY_TASK_PROBE_TIMEOUT_SECONDS = 0;
50+
4951
protected $signature = 'app:polyglot-worker
5052
{--mode=workflow : Worker mode: workflow or activity}
5153
{--server-url= : Standalone Durable Workflow server URL (defaults to DURABLE_WORKFLOW_SERVER_URL)}
@@ -153,7 +155,11 @@ private function runWorkflowWorker(
153155
$consecutiveIdle = 0;
154156

155157
while (true) {
156-
$queryTask = $client->pollQueryTask($workerId, $taskQueue, 1);
158+
$queryTask = $client->pollQueryTask(
159+
$workerId,
160+
$taskQueue,
161+
self::QUERY_TASK_PROBE_TIMEOUT_SECONDS,
162+
);
157163

158164
if ($queryTask !== null) {
159165
$consecutiveIdle = 0;

app/Polyglot/ServerClient.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,10 +237,12 @@ public function failQueryTask(
237237
private function pollTask(string $path, string $workerId, string $taskQueue, int $timeoutSeconds): ?array
238238
{
239239
$pollTimeoutSeconds = WorkerProtocolVersion::clampLongPollTimeout($timeoutSeconds);
240-
$requestTimeoutSeconds = max(
241-
$pollTimeoutSeconds,
242-
WorkerProtocolVersion::DEFAULT_LONG_POLL_TIMEOUT,
243-
) + 5;
240+
$requestTimeoutSeconds = $pollTimeoutSeconds === 0
241+
? 1
242+
: max(
243+
$pollTimeoutSeconds,
244+
WorkerProtocolVersion::DEFAULT_LONG_POLL_TIMEOUT,
245+
) + 5;
244246

245247
try {
246248
$response = $this->workerPost($path, [

composer.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/resolve-current-artifacts.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#!/usr/bin/env bash
22
set -euo pipefail
33

4-
pinned_server_image="durableworkflow/server:0.2.527"
4+
pinned_server_image="durableworkflow/server:0.2.528"
55
pinned_cli_version="0.1.82"
66
pinned_python_sdk_version="0.4.92"
7-
pinned_workflow_version="2.0.0-alpha.235"
7+
pinned_workflow_version="2.0.0-alpha.236"
88
pinned_waterline_version="2.0.0-alpha.111"
99
current_artifact_tuple_url="${DURABLE_WORKFLOW_CURRENT_ARTIFACT_TUPLE_URL:-https://durable-workflow.com/docs-page-release-audit.json}"
1010
waterline_catalog_url="${DURABLE_WORKFLOW_WATERLINE_CATALOG_URL:-https://repo.packagist.org/p2/durable-workflow/waterline.json}"

tests/Unit/PolyglotComposeContractTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -411,11 +411,11 @@ public function test_polyglot_smoke_installs_published_cli_and_configures_waterl
411411
$this->assertStringNotContainsString('DURABLE_WORKFLOW_WATERLINE_VERSION:=2.0.0-', $smokeShell);
412412
$this->assertIsArray($lockedPackages['durable-workflow/workflow'] ?? null);
413413
$this->assertSame(
414-
'2.0.0-alpha.235',
414+
'2.0.0-alpha.236',
415415
$lockedPackages['durable-workflow/workflow']['version'] ?? null,
416416
);
417417
$this->assertSame(
418-
'7025ae69d934557debbf7000c8dafa78502467fc',
418+
'35b8ea0dc5e189b392240b5fef96f2ee0295ebde',
419419
$lockedPackages['durable-workflow/workflow']['source']['reference'] ?? null,
420420
);
421421
$this->assertIsArray($lockedPackages['durable-workflow/waterline'] ?? null);
@@ -624,11 +624,11 @@ public function test_polyglot_artifact_resolver_keeps_default_current_tuple_at_c
624624
'DURABLE_WORKFLOW_WATERLINE_CATALOG_URL' => 'file://'.$this->repoPath('tests/Fixtures/lagging-waterline-catalog.json'),
625625
], false);
626626

627-
$this->assertSame('durableworkflow/server:0.2.527', $assignments['DURABLE_SERVER_IMAGE'] ?? null);
628-
$this->assertSame('0.2.527', $assignments['DURABLE_SERVER_VERSION'] ?? null);
627+
$this->assertSame('durableworkflow/server:0.2.528', $assignments['DURABLE_SERVER_IMAGE'] ?? null);
628+
$this->assertSame('0.2.528', $assignments['DURABLE_SERVER_VERSION'] ?? null);
629629
$this->assertSame('0.1.82', $assignments['DURABLE_WORKFLOW_CLI_VERSION'] ?? null);
630630
$this->assertSame('0.4.92', $assignments['DURABLE_WORKFLOW_PYTHON_SDK_VERSION'] ?? null);
631-
$this->assertSame('2.0.0-alpha.235', $assignments['DURABLE_WORKFLOW_PHP_SDK_VERSION'] ?? null);
631+
$this->assertSame('2.0.0-alpha.236', $assignments['DURABLE_WORKFLOW_PHP_SDK_VERSION'] ?? null);
632632
$this->assertSame('2.0.0-alpha.111', $assignments['DURABLE_WORKFLOW_WATERLINE_VERSION'] ?? null);
633633
}
634634

@@ -638,14 +638,14 @@ public function test_polyglot_artifact_resolver_keeps_pinned_tuple_explicit(): v
638638
'DURABLE_WORKFLOW_ARTIFACT_SOURCE' => 'pinned',
639639
]);
640640

641-
$this->assertSame('durableworkflow/server:0.2.527', $assignments['DURABLE_SERVER_IMAGE'] ?? null);
642-
$this->assertSame('0.2.527', $assignments['DURABLE_SERVER_VERSION'] ?? null);
641+
$this->assertSame('durableworkflow/server:0.2.528', $assignments['DURABLE_SERVER_IMAGE'] ?? null);
642+
$this->assertSame('0.2.528', $assignments['DURABLE_SERVER_VERSION'] ?? null);
643643
$this->assertSame('0.1.82', $assignments['DURABLE_WORKFLOW_CLI_VERSION'] ?? null);
644644
$this->assertSame('dw==0.1.82', $assignments['DURABLE_WORKFLOW_CLI_PIN'] ?? null);
645645
$this->assertSame('0.4.92', $assignments['DURABLE_WORKFLOW_PYTHON_SDK_VERSION'] ?? null);
646-
$this->assertSame('2.0.0-alpha.235', $assignments['DURABLE_WORKFLOW_PHP_SDK_VERSION'] ?? null);
646+
$this->assertSame('2.0.0-alpha.236', $assignments['DURABLE_WORKFLOW_PHP_SDK_VERSION'] ?? null);
647647
$this->assertSame(
648-
'durable-workflow/workflow:2.0.0-alpha.235',
648+
'durable-workflow/workflow:2.0.0-alpha.236',
649649
$assignments['DURABLE_WORKFLOW_PHP_SDK_PIN'] ?? null,
650650
);
651651
$this->assertSame('2.0.0-alpha.111', $assignments['DURABLE_WORKFLOW_WATERLINE_VERSION'] ?? null);

tests/Unit/PolyglotServerClientTest.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,30 @@ public function test_poll_workflow_task_sends_clamped_protocol_timeout(): void
4040
], $requestBody);
4141
}
4242

43+
public function test_poll_query_task_can_send_immediate_protocol_probe(): void
44+
{
45+
$http = new HttpFactory();
46+
$requestPath = null;
47+
$requestBody = null;
48+
49+
$http->fake(function (Request $request) use ($http, &$requestPath, &$requestBody) {
50+
$requestPath = $request->url();
51+
$requestBody = $request->data();
52+
53+
return $http->response(['task' => null]);
54+
});
55+
56+
$client = new ServerClient($http, 'http://server:8080', 'test-token', 'default');
57+
58+
$this->assertNull($client->pollQueryTask('php-worker', 'polyglot-php-to-python', 0));
59+
$this->assertSame('http://server:8080/api/worker/query-tasks/poll', $requestPath);
60+
$this->assertSame([
61+
'worker_id' => 'php-worker',
62+
'task_queue' => 'polyglot-php-to-python',
63+
'timeout_seconds' => 0,
64+
], $requestBody);
65+
}
66+
4367
public function test_poll_workflow_task_treats_http_timeout_as_empty_poll(): void
4468
{
4569
$http = new HttpFactory();

tests/Unit/PolyglotWorkerReplayTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ public function test_workflow_worker_polls_query_tasks_before_heartbeat_after_re
132132
'http://server:8080/api/worker/query-tasks/poll',
133133
$requests[1]['url'] ?? null,
134134
);
135+
$this->assertSame(0, $requests[1]['body']['timeout_seconds'] ?? null);
135136
$this->assertSame(
136137
'http://server:8080/api/worker/heartbeat',
137138
$requests[2]['url'] ?? null,

0 commit comments

Comments
 (0)