amzn / smoke-http

Specialised HTTP Client for service operations abstracted from the HTTP protocol.
Apache License 2.0
71 stars 15 forks source link

Make the RetriableOutwardsRequestLatencyAggregator thread safe. #107

Closed tachyonics closed 2 years ago

tachyonics commented 2 years ago

Issue #, if available:

Description of changes: Address an issue where parallel service calls within the same server request could cause the application to crash due to mutation of RetriableOutwardsRequestLatencyAggregator's internal mutable state from multiple threads. This change is non-breaking and adds additional functions to the OutwardsRequestAggregator protocol with default implementations. The new implementations in RetriableOutwardsRequestLatencyAggregator use a dispatch queue to serialise access to the class' mutable state. The existing methods have been marked as deprecated due to the likelihood that they will not be thread safe.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.