Skip to content

Add onDegraded, degradedThreshold, circuitBreakDuration to createServicePolicy#5143

Merged
mcmire merged 5 commits intomainfrom
extract-create-service-policy-2
Jan 14, 2025
Merged

Add onDegraded, degradedThreshold, circuitBreakDuration to createServicePolicy#5143
mcmire merged 5 commits intomainfrom
extract-create-service-policy-2

Conversation

@mcmire
Copy link
Copy Markdown
Contributor

@mcmire mcmire commented Jan 13, 2025

Explanation

This commit is a continuation of a previous commit which added a utility function for use in service classes which ensures that they follow the circuit breaker and retry patterns.

This commit adds three more options to createServicePolicy:

  • onDegraded, a callback which handles when the service succeeds but takes too long to run
  • degradedThreshold, the duration which counts as "too long"
  • circuitBreakDuration, which governs how long the circuit stays open after breaking before the service is re-evaluated

References

Progresses #4994.

Changelog

(Updated in PR)

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've highlighted breaking changes using the "BREAKING" category above as appropriate
  • I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes

Base automatically changed from extract-create-service-policy-1 to main January 14, 2025 16:19
This commit is a continuation of a previous commit which added a utility
function for use in service classes which ensures that they follow the
circuit breaker and retry patterns.

This commit adds two more options to `createServicePolicy`:

- `onDegraded`, a callback which handles when the service succeeds but
  takes too long to run
- `degradedThreshold`, the duration which counts as "too long"
@mcmire mcmire force-pushed the extract-create-service-policy-2 branch from 7420f24 to b2c06f4 Compare January 14, 2025 16:21
@mcmire mcmire marked this pull request as ready for review January 14, 2025 16:27
@mcmire mcmire requested a review from a team as a code owner January 14, 2025 16:27
@mcmire mcmire changed the title Add onDegraded and degradedThreshold to createServicePolicy Add onDegraded, degradedThreshold, circuitBreakDuration to createServicePolicy Jan 14, 2025
Copy link
Copy Markdown
Contributor

@cryptodev-2s cryptodev-2s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@mcmire mcmire merged commit 0429d92 into main Jan 14, 2025
@mcmire mcmire deleted the extract-create-service-policy-2 branch January 14, 2025 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants