diff --git a/mixerclient/src/quota_cache.cc b/mixerclient/src/quota_cache.cc index 441c4b3db8c..d5632e17d9b 100644 --- a/mixerclient/src/quota_cache.cc +++ b/mixerclient/src/quota_cache.cc @@ -75,6 +75,10 @@ QuotaCache::QuotaCache(const QuotaOptions& options, QuotaTransport* transport) // Excluse quota_amount in the key calculation. cache_keys_ = CacheKeySet::CreateExclusive({Attributes::kQuotaAmount}); + + if (transport_ != nullptr) { + transport_->set_best_effort(true); + } } } diff --git a/mixerclient/src/transport.h b/mixerclient/src/transport.h index d3768d42b0b..1b43d016295 100644 --- a/mixerclient/src/transport.h +++ b/mixerclient/src/transport.h @@ -80,7 +80,11 @@ typedef Transport<::istio::mixer::v1::QuotaRequest, class QuotaTransport : public QuotaBaseTransport { public: QuotaTransport(TransportInterface* transport) - : QuotaBaseTransport(transport), deduplication_id_(0) {} + : QuotaBaseTransport(transport), + best_effort_(false), + deduplication_id_(0) {} + + void set_best_effort(bool v) { best_effort_ = v; } private: void FillProto(StreamID stream_id, const Attributes& attributes, @@ -98,11 +102,12 @@ class QuotaTransport : public QuotaBaseTransport { } } request->set_deduplication_id(std::to_string(deduplication_id_++)); - request->set_best_effort(false); + request->set_best_effort(best_effort_); QuotaBaseTransport::FillProto(stream_id, filtered_attributes, request); } + bool best_effort_; int64_t deduplication_id_; };