Skip to content

Commit cf6a640

Browse files
Polyglot conformance: typed-error activity hangs on PHP worker path (#331)
1 parent 4037d0e commit cf6a640

2 files changed

Lines changed: 13 additions & 5 deletions

File tree

app/Polyglot/ServerClient.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,15 @@ private function pollTask(string $path, string $workerId, string $taskQueue, int
262262

263263
private function requestTimeoutForPoll(int $pollTimeoutSeconds): int
264264
{
265-
return $pollTimeoutSeconds === 0 ? 1 : $pollTimeoutSeconds + 5;
265+
if ($pollTimeoutSeconds === 0) {
266+
return 1;
267+
}
268+
269+
// Keep the client-side timeout comfortably above the server-held
270+
// long-poll window. Under loaded conformance runs, request handling can
271+
// overrun the nominal poll timeout; if the HTTP client gives up first,
272+
// the server can still lease a task to a worker that never receives it.
273+
return $pollTimeoutSeconds + 15;
266274
}
267275

268276
/**

tests/Unit/PolyglotServerClientTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@ public function test_poll_request_timeout_tracks_the_requested_poll_window(): vo
7272
$method->setAccessible(true);
7373

7474
$this->assertSame(1, $method->invoke($client, 0));
75-
$this->assertSame(6, $method->invoke($client, 1));
76-
$this->assertSame(10, $method->invoke($client, 5));
77-
$this->assertSame(35, $method->invoke($client, 30));
78-
$this->assertSame(65, $method->invoke($client, 60));
75+
$this->assertSame(16, $method->invoke($client, 1));
76+
$this->assertSame(20, $method->invoke($client, 5));
77+
$this->assertSame(45, $method->invoke($client, 30));
78+
$this->assertSame(75, $method->invoke($client, 60));
7979
}
8080

8181
public function test_poll_workflow_task_treats_http_timeout_as_empty_poll(): void

0 commit comments

Comments
 (0)