Skip to content

Commit

Permalink
Fix(apple): Add timeout to request (#47)
Browse files Browse the repository at this point in the history
Invalid auth with Apple causing the call to hang indefinitely

Co-authored-by: 121593 <5079173-121593@users.noreply.gitlab.com>
  • Loading branch information
121593 and 121593 authored Dec 9, 2023
1 parent 8a2e1fe commit 6b8b8f0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Sender/PushMessageSender.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

class PushMessageSender implements PushMessagerSenderInterface
{
const DEFAULT_TIMEOUT = 30;

/**
* @var Client
*/
Expand Down Expand Up @@ -90,7 +92,7 @@ public function push(PushMessage $message, iterable $subscriptions): iterable
$request = $this->requestBuilder->withGCMAuthentication($request, $auth['GCM']);
}

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

0 comments on commit 6b8b8f0

Please sign in to comment.