16 #include <aws/core/client/AWSError.h> 21 #include <unordered_map> 47 template <
class T,
class U,
class E,
typename... ErrorArgs>
48 T
MakeCall(std::function<T(
const U & request)> api,
const U & api_param, std::string api_name,
49 ErrorArgs... error_on_throttling_args)
const 52 return api(api_param);
55 auto min_delta_allowed = std::chrono::duration_cast<std::chrono::milliseconds>(
62 api_name, std::chrono::time_point<std::chrono::steady_clock>(std::chrono::seconds(0))));
64 auto now = std::chrono::steady_clock::now();
65 auto delta_in_ms = std::chrono::duration_cast<std::chrono::milliseconds>(
68 if (delta_in_ms >= min_delta_allowed) {
70 return api(api_param);
72 T outcome(Aws::Client::AWSError<E>(error_on_throttling_args...));
87 mutable std::unordered_map<std::string, std::chrono::time_point<std::chrono::steady_clock>>
std::mutex api_call_time_mutex_
std::unordered_map< std::string, std::chrono::time_point< std::chrono::steady_clock > > last_call_time_per_api_
std::unordered_map< std::string, double > max_api_tps_
T MakeCall(std::function< T(const U &request)> api, const U &api_param, std::string api_name, ErrorArgs...error_on_throttling_args) const
void SetMaxApiTps(const std::string &api, double tps)