nghttpx: Fast backend replacement on multi thread environment
This commit is contained in:
parent
50c9c3358a
commit
96218a1078
|
@ -162,11 +162,15 @@ void Worker::replace_downstream_config(
|
||||||
|
|
||||||
downstreamconf_ = downstreamconf;
|
downstreamconf_ = downstreamconf;
|
||||||
|
|
||||||
downstream_addr_groups_ = std::vector<std::shared_ptr<DownstreamAddrGroup>>(
|
// Making a copy is much faster with multiple thread on
|
||||||
downstreamconf->addr_groups.size());
|
// backendconfig API call.
|
||||||
|
auto groups = downstreamconf->addr_groups;
|
||||||
|
|
||||||
for (size_t i = 0; i < downstreamconf->addr_groups.size(); ++i) {
|
downstream_addr_groups_ =
|
||||||
auto &src = downstreamconf->addr_groups[i];
|
std::vector<std::shared_ptr<DownstreamAddrGroup>>(groups.size());
|
||||||
|
|
||||||
|
for (size_t i = 0; i < groups.size(); ++i) {
|
||||||
|
auto &src = groups[i];
|
||||||
auto &dst = downstream_addr_groups_[i];
|
auto &dst = downstream_addr_groups_[i];
|
||||||
|
|
||||||
dst = std::make_shared<DownstreamAddrGroup>();
|
dst = std::make_shared<DownstreamAddrGroup>();
|
||||||
|
|
Loading…
Reference in New Issue