Skip to content

Commit 6b8b8f0

Browse files
121593121593
and
121593
authored
Fix(apple): Add timeout to request (#47)
Invalid auth with Apple causing the call to hang indefinitely Co-authored-by: 121593 <[email protected]>
1 parent 8a2e1fe commit 6b8b8f0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Sender/PushMessageSender.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515

1616
class PushMessageSender implements PushMessagerSenderInterface
1717
{
18+
const DEFAULT_TIMEOUT = 30;
19+
1820
/**
1921
* @var Client
2022
*/
@@ -90,7 +92,7 @@ public function push(PushMessage $message, iterable $subscriptions): iterable
9092
$request = $this->requestBuilder->withGCMAuthentication($request, $auth['GCM']);
9193
}
9294

93-
$promises[$subscriptionHash] = $this->client->sendAsync($request)
95+
$promises[$subscriptionHash] = $this->client->sendAsync($request, ['timeout' => self::DEFAULT_TIMEOUT])
9496
->then(function (ResponseInterface $response) use ($subscription) {
9597
return new PushResponse($subscription, $response->getStatusCode());
9698
})

0 commit comments

Comments
 (0)