diff options
author | qrort <qrort@yandex-team.com> | 2022-11-30 23:47:12 +0300 |
---|---|---|
committer | qrort <qrort@yandex-team.com> | 2022-11-30 23:47:12 +0300 |
commit | 22f8ae0e3f5d68b92aecccdf96c1d841a0334311 (patch) | |
tree | bffa27765faf54126ad44bcafa89fadecb7a73d7 /library/cpp/http/client/scheduler.cpp | |
parent | 332b99e2173f0425444abb759eebcb2fafaa9209 (diff) | |
download | ydb-22f8ae0e3f5d68b92aecccdf96c1d841a0334311.tar.gz |
validate canons without yatest_common
Diffstat (limited to 'library/cpp/http/client/scheduler.cpp')
-rw-r--r-- | library/cpp/http/client/scheduler.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/library/cpp/http/client/scheduler.cpp b/library/cpp/http/client/scheduler.cpp new file mode 100644 index 0000000000..87670bfb45 --- /dev/null +++ b/library/cpp/http/client/scheduler.cpp @@ -0,0 +1,37 @@ +#include "scheduler.h" + +namespace NHttp { + namespace { + class TDefaultHostsPolicy: public IHostsPolicy { + public: + size_t GetMaxHostConnections(const TStringBuf&) const override { + return 20; + } + }; + + } + + TScheduler::TScheduler() + : HostsPolicy_(new TDefaultHostsPolicy) + { + } + + TFetchRequestRef TScheduler::Extract() { + { + auto g(Guard(Lock_)); + + if (!RequestQueue_.empty()) { + TFetchRequestRef result(RequestQueue_.front()); + RequestQueue_.pop(); + return result; + } + } + return TFetchRequestRef(); + } + + void TScheduler::Schedule(TFetchRequestRef req) { + auto g(Guard(Lock_)); + RequestQueue_.push(req); + } + +} |