mirror of
https://github.com/hanzoai/tasks.git
synced 2026-10-04 02:04:03 +00:00
## What changed? Allow frontend->matching poll requests to retry up to their context timeout instead of just once. ## Why? On matching service deployments, a busy new matching node may hit its persistence rps limit trying to acquire new task queues and be unable to accept polls. ## How did you test it? - [x] built - [ ] run locally and tested manually - [ ] covered by existing tests - [ ] added new unit test(s) - [ ] added new functional test(s)
31 lines
798 B
Go
31 lines
798 B
Go
package matching
|
|
|
|
import (
|
|
"go.temporal.io/server/api/matchingservice/v1"
|
|
"go.temporal.io/server/common/backoff"
|
|
)
|
|
|
|
var _ matchingservice.MatchingServiceClient = (*retryableClient)(nil)
|
|
|
|
type retryableClient struct {
|
|
client matchingservice.MatchingServiceClient
|
|
policy backoff.RetryPolicy
|
|
pollPolicy backoff.RetryPolicy
|
|
isRetryable backoff.IsRetryable
|
|
}
|
|
|
|
// NewRetryableClient creates a new instance of matchingservice.MatchingServiceClient with retry policy
|
|
func NewRetryableClient(
|
|
client matchingservice.MatchingServiceClient,
|
|
policy,
|
|
pollPolicy backoff.RetryPolicy,
|
|
isRetryable backoff.IsRetryable,
|
|
) matchingservice.MatchingServiceClient {
|
|
return &retryableClient{
|
|
client: client,
|
|
policy: policy,
|
|
pollPolicy: pollPolicy,
|
|
isRetryable: isRetryable,
|
|
}
|
|
}
|