| 1 | <?php |
| 2 | namespace Aws\Retry\V3; |
| 3 | |
| 4 | /** |
| 5 | * Operations that use server-side long polling and should not be retried |
| 6 | * when the retry quota is exhausted; instead the middleware sleeps for |
| 7 | * the computed backoff and lets the next request proceed. |
| 8 | * |
| 9 | * @internal |
| 10 | */ |
| 11 | final class LongPolling |
| 12 | { |
| 13 | private const OPERATIONS = [ |
| 14 | 'sqs' => ['ReceiveMessage' => true], |
| 15 | 'states' => ['GetActivityTask' => true], |
| 16 | 'swf' => [ |
| 17 | 'PollForActivityTask' => true, |
| 18 | 'PollForDecisionTask' => true, |
| 19 | ], |
| 20 | ]; |
| 21 | |
| 22 | public static function isLongPolling(?string $service, string $operation): bool |
| 23 | { |
| 24 | return $service !== null |
| 25 | && isset(self::OPERATIONS[$service][$operation]); |
| 26 | } |
| 27 | } |