Replies: 1 comment
-
You should try using WithTimeout for this. func slowOperationWithTimeout(ctx context.Context) (Result, error) {
ctx, cancel := context.WithTimeout(ctx, 100*time.Millisecond)
defer cancel() // releases resources if slowOperation completes before timeout elapses
return slowOperation(ctx)
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am using this SDK for DynamoDB operations in my application.
We have seen occasional spikes in latency which causes requests to timeout.
I want to configure the client in such a way that the request times out fast and automatically retries with exponential backoff.
AWS support pointed me to this resource https://aws.amazon.com/blogs/database/tuning-aws-java-sdk-http-request-settings-for-latency-aware-amazon-dynamodb-applications/ , but it looks like that is for Java SDK and I am not sure how to map that for the go sdk.
Any help/examples and insight would be great. Thanks
Beta Was this translation helpful? Give feedback.
All reactions