Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/honzamac/conditional-retry
Retry any third party api call based on you custom conditions
https://github.com/honzamac/conditional-retry
failover php7 retrying
Last synced: 2 months ago
JSON representation
Retry any third party api call based on you custom conditions
- Host: GitHub
- URL: https://github.com/honzamac/conditional-retry
- Owner: HonzaMac
- License: mit
- Created: 2017-06-19T22:11:06.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-08-16T20:17:04.000Z (over 7 years ago)
- Last Synced: 2024-09-30T14:06:22.080Z (3 months ago)
- Topics: failover, php7, retrying
- Language: PHP
- Homepage:
- Size: 7.81 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Conditional retry
Conditionally retry any third party api call.
Sometimes network connection is not working properly and we would like to retry api call. Using this tiny library you can easily retry any action based on specific error condition throwed by exception or returned value.
[![Build Status](https://travis-ci.org/HonzaMac/conditional-retry.svg?branch=master)](https://travis-ci.org/HonzaMac/conditional-retry)
## Usage
Reason for retry is returned via `return $result`. First argument is required api call, second argument is conditional callback, third argument defines how many total runs will api call do.
```php
sms->send('+420800100200', 'Help, I\'m drowning!');
return $result;
}, function ($returnValue) {
return !$returnValue;
}, 3);
```Reason for retry is returned via `RuntiomeException`.
```php