1
0
mirror of synced 2025-12-25 02:09:19 -05:00

[low-code]: Evaluate backoff strategies at runtime (#18053)

* pass options to wait time from header

* fix constant backoff

* parameterize test

* fix tests

* missing unit tests

* eval header at runtime

* eval regex at runtime

* evaluate min_wait at runtime

* eval factor at runtime

* missing unit tests

* remove debug print

* rename

* Add tests

* Add tests

* Update docs
This commit is contained in:
Alexandre Girard
2022-11-03 18:50:47 -07:00
committed by GitHub
parent 838aebe322
commit 605fb921c4
13 changed files with 211 additions and 106 deletions

View File

@@ -157,8 +157,8 @@ Schema:
BackoffStrategy:
type: object
anyOf:
- "$ref": "#/definitions/ExponentialBackoff"
- "$ref": "#/definitions/ConstantBackoff"
- "$ref": "#/definitions/ExponentialBackoffStrategy"
- "$ref": "#/definitions/ConstantBackoffStrategy"
- "$ref": "#/definitions/WaitTimeFromHeader"
- "$ref": "#/definitions/WaitUntilTimeFromHeader"
```
@@ -170,7 +170,7 @@ This is the default backoff strategy. The requester will backoff with an exponen
Schema:
```yaml
ExponentialBackoff:
ExponentialBackoffStrategy:
type: object
additionalProperties: true
properties:
@@ -183,12 +183,12 @@ Schema:
### Constant Backoff
When using the `ConstantBackoff` strategy, the requester will backoff with a constant interval.
When using the `ConstantBackoffStrategy` strategy, the requester will backoff with a constant interval.
Schema:
```yaml
ConstantBackoff:
ConstantBackoffStrategy:
type: object
additionalProperties: true
required:
@@ -340,13 +340,13 @@ requester:
- predicate: "{{ 'code' in response }}"
action: RETRY
backoff_strategies:
- type: "ConstantBackoff"
- type: "ConstantBackoffStrategy"
backoff_time_in_seconds: 5
- response_filters:
- http_codes: [ 403 ]
action: RETRY
backoff_strategies:
- type: "ExponentialBackoff"
- type: "ExponentialBackoffStrategy"
```
## More readings